broadcastreceiver - android BootCompletedReceiver not fire -
i have android application config on manifest :
<receiver android:name="ir.hamgam.fion.ec.mobile.services.bootcompletedreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed"/> </intent-filter> </receiver>
and in receiver have :
public class bootcompletedreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_boot_completed)) { log.w("boot_broadcast_poc", "starting service..."); apkupdatereceiver.setalarm(context); datareceiver.setalarm(context); notificationupdatereceiver.setalarm(context); } } }
when application starts , boot completed not fire inside method onreceive,give me hint please.
please below, works fine. put toast inside receiver notified receiver called -
public class bootcompletedreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { if (intent.getaction().equals(intent.action_boot_completed)) { log.w("boot_broadcast_poc", "starting service..."); toast.maketext(context, "helllllooooooo ", toast.length_long).show(); // apkupdatereceiver.setalarm(context); // datareceiver.setalarm(context); // notificationupdatereceiver.setalarm(context); } } }
now change manifest below -
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.shajib.stackoverflow"> <uses-permission android:name="android.permission.receive_boot_completed" /> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <receiver android:name=".bootcompletedreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed"/> </intent-filter> </receiver> </application>
Comments
Post a Comment