Uygulamamda aşağıdaki kodu içeren bir bildirim var:
//Notification Start
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
int icon = R.drawable.n1;
CharSequence tickerText = "Call Blocker";
long when = System.currentTimeMillis(); //now
Notification notification = new Notification(icon, tickerText, when);
Intent notificationIntent = new Intent(context, Main.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
Context context = getApplicationContext();
CharSequence title = "Call Blocker";
text = "Calls will be blocked while driving";
notification.setLatestEventInfo(context, title, text, contentIntent);
notification.flags |= Notification.FLAG_ONGOING_EVENT;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notificationManager.notify(1, notification);
}
Bildirimlerim çok iyi çalışıyor, ancak benim sorunum, Bildirim Merkezi'nde bildirime tıkladığımda uygulamamı başlatmıyor.
Temel olarak, bildirimime tıkladıktan sonra hiçbir şey olmuyor! Bildirimime tıkladıktan sonra Ana faaliyetime başlamak için ne yapmalıyım? Teşekkürler.
Context context = getApplicationContext();önce hareket edin Notification notification = new Notification(icon, tickerText, when);Faaliyete başlamak için doğru bağlamı