0

I have implemented the notification for my device.

It works great. But if i reboot the device it is not going to work at all.

So whats the wrong with it ? Should i have to add anithing in manifest ?

I have added this code to receive the broadcast of notification class.

code:

    <!-- To receive the Alarm Notification -->
    <receiver android:name=".AlarmNotificationReceiver" android:enabled="true">  
        <intent-filter>  
            <action android:name="android.intent.action.PHONE_STATE"></action>  
        </intent-filter>  
    </receiver>

Thanks.

3
  • It is Just the notification that display the message. And I have implemented the alarmManager to set its time of notification. – Shreyash Mahajan Dec 28 '11 at 6:13
  • You have to BroadCast the action of Boot Completed for having the Notification. – Lalit Poptani Dec 28 '11 at 6:15
  • @LalitPoptani : Yes i think something like that. Please answer me with that code. – Shreyash Mahajan Dec 28 '11 at 6:21
6

Make a class that extends the BroadcastReceiver and put the AlarmManager code in its onReceive then you can resgister the BroadcastReceiver in the Manifest file as below.

<receiver android:name=".MyReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
</receiver>

Also add the Permission to the Manifest File.

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.