タブビュー(小さな画面の約1/3を要した)から、通知メッセージを介して選択可能なフルスクリーンに切り替えようとしていました。
これまでのところ、多くのハウツーの指示に従ってすべてがうまく機能しています。(それはsdkエミュレータにあります)
今、私はアプリを実際の Android 電話に転送しましたが、通知を介して画面を切り替えることはもうありません。常に 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);
}
では、特定のアクティビティによって呼び出された通知を、指定したアクティビティを開くにはどうすればよいですか?