Skip to content Skip to sidebar Skip to footer

Why Broadcastreceiver Doesn't Receive The Broadcast?

As mentioned in the question, and the following shows mu code .. AlarmActivity package adham.test; import android.app.Activity; import android.content.Context; import android.cont

Solution 1:

I think you never raise any broadcast. Your code shows:

Intent i = newIntent(c,AlarmReceiver.class);
i.putExtra("alarm_message", "Hello, Alarm is running !");
PendingIntent pi= PendingIntent.getActivity(c, 19237, i, PendingIntent.FLAG_UPDATE_CURRENT);

You are calling getActivity but AlarmReceiver is a Broadcast, you need to call getBroadcast(...) instead.

Post a Comment for "Why Broadcastreceiver Doesn't Receive The Broadcast?"