アクティビティが起動した通知をクリックして、通知を作成するブロードキャストレシーバーを作成しました。そのアクティビティは起動していますが、表示できませんでした。次のコードを使用しています。
private NotificationManager notificationManager;
@Override
public void onReceive(Context context, Intent intent) {
if (notificationManager == null) {
notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
}
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setTicker("Its Ticker")
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Notification Title")
.setContentText("Its Content")
.setAutoCancel(true)
.setContentIntent(PendingIntent.getActivity(context,0,new Intent(context, NotificationDialog.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK),0));
notificationManager.notify("interstitial_tag", 0, builder.getNotification());
}
注:NotificationDialog.java
これは私のアクティビティです。このアクティビティは、デバッグしたときに実行されていますが、表示されていません。何時間も試してみましたが、答えが見つかりませんでした。提案をいただければ幸いです。