Take the 2-minute tour ×

okay so ive tried everything i can find, its not working. Here is my code. Can someone tell me why it wont call the Receiver?


<receiver android:name=".AlarmReciever" />


public class AlarmReciever extends BroadcastReceiver 

    private static final Logger LOGGER = Logger.getLogger(LogService.class);

      public void onReceive(Context context, Intent intent) 

         LOGGER.debug("BroadcastReceiver, in onReceive:");



public class DeviceMonitor extends Service 
    public int onStartCommand(Intent intent, int flags, int startld) 

        LOGGER.debug("alarmmanger settting from on start");

        AlarmManager alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
        Intent I = new Intent(this, AlarmReciever.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, I, 0);
        Calendar time = Calendar.getInstance();
        time.add(Calendar.SECOND, 5);
        alarmMgr.set(AlarmManager.RTC_WAKEUP, time.getTimeInMillis(), pendingIntent);

        LOGGER.debug("alarmmanger set from on start");
share|improve this question

3 Answers 3

maybe a bit more description could be useful for example do you get no logging message from your code, or it throws exception or ...

But I have a working code, which implements the same methods as you show at your question. Unfortunately you haven't posted all the relevant parts of the AndroidManifest.xml but I have this, maybe it will help.

        android:label="@string/app_name" >
            <action android:name="android.provider.Telephony.SMS_RECEIVED" >

This calls AtlasIncomingSMSReceiver class when a new SMS is received.

share|improve this answer
the onStart methods runs. it logs everything to the Log file, except the broadcast receiver onRecieve method. –  Jason Portnoy Aug 26 '13 at 19:18
When you define <receiver android:name="com.example.MyBroadcastReceiver"> you tell the app which Class to call, but you haven't told anything about when. You should make an <intent-filter> childnode (like above) and tell what to listen to. For example: <intent-filter><action android:name="cica"></action></intent-filter> After you defined what and when you can call this like: Intent i = new Intent("cica"); sendBroadcast(i); Of course you can use pre-defined events to listen to like: <action android:name="android.provider.Telephony.SMS_RECEIVED" > –  csikos.balint Aug 27 '13 at 8:40

I think if you use AlarmReceiver instead of .AlarmReceiver in the android mainfest file it will work.

share|improve this answer

I seemed to fix the problem by using the fully qualified path name i the xml document


and i was able to troubleshoot it using

Intent i = new Intent();

which forced the sending of the boradcast

really hope this hopes someone. I'm new to Android development and this was killing me.

share|improve this answer

Your Answer


