Android app doesn't start at system boot -
i've reciever
public class mybroadcastreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { intent mystarterintent = new intent(context, mainactivity.class); context.startactivity(mystarterintent); } }
and have modified androidmanifest.xml, adding these lines
<receiver android:enabled="true" android:name=".mybroadcastreceiver" android:permission="android.permission.receive_boot_completed" android:exported="true"> <intent-filter> <action android:name="android.intent.action.boot_completed"/> <category android:name="android.intent.category.default" /> </intent-filter> </receiver>
to section. application still not start on system boot..any ideas appreciated. @ least how can monitor going on after device reboot (because cant use breakpoints in case)
you need provide intent.flag_activity_new_task
flag when starting activity broadcastreceiver
.
intent mystarterintent = new intent(context, mainactivity.class); mystarterintent.addflags(intent.flag_activity_new_task); context.startactivity(mystarterintent);
this how can test broadcastreceiver
.
Comments
Post a Comment