怎样的android到攻通知,当打开最后一次活动
展开全部
NotificationCompat.Builder notificationBuilder =新NotificationCompat.Builder(YourService.this)
.setContentTitle(getResources()。的getText(R.string.app_name))
.setContentText(getServiceStateDescription(YourService.this))
.setSmallIcon(iconId)
.setWhen(System.currentTimeMillis的());
意图nIntent = GET previousIntent();
TaskStackBuilder stackBuilder = TaskStackBuilder.create(本);
//添加后退堆栈
stackBuilder.addParentStack(MainActivity_.class);
stackBuilder.addNextIntent(nIntent);
PendingIntent pendingIntent =
stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);
notificationBuilder.setContentIntent(pendingIntent);
startForeground(ContextConstants.LAUNCHER_SERVICE_NOTE_ID,notificationBuilder.build());
.setContentTitle(getResources()。的getText(R.string.app_name))
.setContentText(getServiceStateDescription(YourService.this))
.setSmallIcon(iconId)
.setWhen(System.currentTimeMillis的());
意图nIntent = GET previousIntent();
TaskStackBuilder stackBuilder = TaskStackBuilder.create(本);
//添加后退堆栈
stackBuilder.addParentStack(MainActivity_.class);
stackBuilder.addNextIntent(nIntent);
PendingIntent pendingIntent =
stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);
notificationBuilder.setContentIntent(pendingIntent);
startForeground(ContextConstants.LAUNCHER_SERVICE_NOTE_ID,notificationBuilder.build());
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询