在AndroidWear中,每当我在我的应用中开始持续通知时,我都会退出主屏幕(我想带我去进行持续通知?)
有没有办法解决这个问题。我想开始持续通知,但是当我做
时,不会立即将我的用户从我的应用中删除以下是我创建通知的方式:
Intent intent = new Intent(iFilter);
PendingIntent pIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
Intent intent2 = new Intent(context, MainActivity.class);
PendingIntent pIntent2 = PendingIntent.getActivity(context, 0, intent2, 0);
Notification n = new Notification.Builder(context)
.setContentTitle(context.getResources().getString(R.string.app_active))
.setContentText(context.getResources().getString(R.string.touch_to_return))
.setSmallIcon(R.drawable.notification_icon)
.setLargeIcon(Utilities.getBitmap(R.drawable.notification_icon_large,context))
.setContentIntent(pIntent2)
.setAutoCancel(false)
.setOngoing(true)
.addAction(R.drawable.ic_action_stop, context.getResources().getString(R.string.stop), pIntent).build();
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationId, n);