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
是你想從通知開始活動。