0
Как я могу активировать действие после нажатия изображения на панели уведомлений? Как я могу сделать намерение? Спасибо.Android, как активировать активность при нажатии уведомления
public class AlarmService extends BroadcastReceiver {
NotificationManager nm;
@Override
public void onReceive(Context context, Intent intent) {
nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "Check your fridge";
CharSequence message = "It's time to eat!";
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(), 0);
Notification notif = new Notification(R.drawable.fridge_icon3,
"Keep Fridge", System.currentTimeMillis());
notif.setLatestEventInfo(context, from, message, contentIntent);
notif.defaults |= Notification.DEFAULT_SOUND;
notif.flags |= Notification.FLAG_AUTO_CANCEL;
nm.notify(1, notif);
}
}
Благодарим Вас за направляющим. Я ставлю так \t \t PendingIntent contentIntent = PendingIntent.getActivity (контекст, 0, \t \t \t \t новый Intent (контекст, KeepFridgeActivity.class), 0); в любом случае, спасибо! – wholee1
Такая же проблема со мной и ваше решение сработало .. :-) Привет! – YuDroid