我试图从 tabview(大约占小屏幕的 1/3)切换到可通过通知消息选择的全屏。
到目前为止一切顺利,一切都按照许多howto的说明完成,一切都像魅力一样。(即在 sdk 模拟器上)
现在我已经将应用程序转移到我的实际安卓手机上,现在它不再通过通知切换屏幕了。它总是打开 MainActivity。
private void DroiDCNotification(int NotificationID, CharSequence tickerText, CharSequence contentTitle, CharSequence contentText) {
//throw new UnsupportedOperationException("Not yet implemented");
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.droidc_icon; // icon from resources
long when = System.currentTimeMillis(); // notification time
Context context = getApplicationContext(); // application Context
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
// the next two lines initialize the Notification, using the configurations above
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(NotificationID, notification);
}
那么如何让特定活动调用的通知打开该指定活动?