broadcastreceiver - Boot Reciever Working on Emulator but not android actual phone -
broadcastreceiver - Boot Reciever Working on Emulator but not android actual phone -
on boot completed starting service runs on emulator when run on android phone broadcast receiver doesn't start service. infact app not receiving boot completed broadcast device.
this manifest file:
<uses-sdk android:minsdkversion="8" android:targetsdkversion="14" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <application android:allowbackup="true" android:icon="@drawable/ic_logo" android:label="@string/app_name" android:theme="@style/apptheme" > <receiver android:name="com.darkrai.smsbasedcontroller.bootreciever" android:enabled="true" android:exported="false" > <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> <uses-permission android:name="android.permission.receive_boot_completed" /> </application>
this broadcast reciever class.
public class bootreciever extends broadcastreceiver{ @override public void onreceive(context context, intent intent) { context.startservice(new intent(context, updateservice.class)); log.d("boot", "boot reciever"); }
your broadcastreceiver
-- action -- not receive broadcasts until on device uses explicit intent
start 1 of components. usually, comes in form of user tapping on activity
of yours in launcher.
so, add together launcher
activity
, tap on it, , receive broadcasts until:
android broadcastreceiver
Comments
Post a Comment