Android Andridwear持续通知停止退出至主屏幕
在AndroidWear中,每当我在我的应用程序中启动一个正在进行的通知时,我都会退出到主屏幕(我想是要带我进入正在进行的通知?) 这有什么办法吗。我想启动一个正在进行的通知,但不想在启动时立即将我的用户踢出我的应用程序 以下是我创建通知的方式:Android Andridwear持续通知停止退出至主屏幕,android,wear-os,Android,Wear Os,在AndroidWear中,每当我在我的应用程序中启动一个正在进行的通知时,我都会退出到主屏幕(我想是要带我进入正在进行的通知?) 这有什么办法吗。我想启动一个正在进行的通知,但不想在启动时立即将我的用户踢出我的应用程序 以下是我创建通知的方式: Intent intent = new Intent(iFilter); PendingIntent pIntent = PendingIntent.getBroadcast(context, 0, intent, 0)
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);
我们能得到一些代码来显示你是如何创建通知的吗?@JessieA.Morris当然,我已经添加了代码