0
我如何使用应用程序的通知,开始一个新的应用程序。 NotificationManager没有提供让我访问生成的通知的方法。有什么建议么?谢谢。使用一个应用程序的通知来调用其他应用程序/活动
我如何使用应用程序的通知,开始一个新的应用程序。 NotificationManager没有提供让我访问生成的通知的方法。有什么建议么?谢谢。使用一个应用程序的通知来调用其他应用程序/活动
你必须与PendingIntent
创建通知。从Android Developers:
Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
Intent notificationIntent = new Intent(this, MyClass.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
private static final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);
哪里MyClass
是你想从通知开始活动。