Skip to content Skip to sidebar Skip to footer

Call Notification From Broadcastreceiver

I have the code : public void AlarmStart() { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, 5); Intent intent = new Intent(MainNote.this, AlarmReceiver

Solution 1:

I think that you don't need any reference to an Activity in the NotifierHelper. Use the Context (which Activity is a subclass of), eg:

publicstaticvoidsendNotification(Context caller, ...

Such methods as getSystemService(), etc.. are actually exposed by Context.

And since you get passed a Context in AlarmReceiver.onReceive(), you can pass it on.

Post a Comment for "Call Notification From Broadcastreceiver"