私は実際にAndroidアプリケーションを進めています。私はonDestroy() and onPause()
ルーチンを実装することができました。Android SDK NOTIFICATION_SERVICEを再開するには、新しいインスタンスを起動しないでください。
私は、Androidの通知サービスを利用して、タイトルと本文のアイコンを通知バー/タスクメニューに配置することもできました。
この通知サービスの唯一の問題は、私のアンドロイドアプリが既に実行されていて、onPause()
の機能がsuper.onPause(); moveTaskToBack(true);
で開始された場合、ユーザーが通知をタップすると、アプリの新しいインスタンスが表示されることです。
ユーザーが新しいインスタンスとやり取りすると、バックグラウンドバージョンが既に実行されているため競合が発生するため、プログラムがクラッシュします。私はbringTaskToFront(this)
オプションのいくつかの並べ替えも可能でonResume()
を見ていた
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificatonManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.ic_launcher;
CharSequence tickerText = "app name";
long when = System.currentTimeMillis();
CharSequence contentTitle = "app title";
CharSequence contentText = "text";
Intent notificationIntent = new Intent(this, SuperMicProActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
final int signed = 1;
mNotificatonManager.notify(signed, notification);
:
は、ここで私は私のアプリのすでに実行されているバージョンのこのコードを見て作るの助けを必要とする、私の通知コードです。これは存在しますか?
ありがとう、
ネヴァーマインド。 私は単にManifestファイルを開き、私の '