service not started on BOOT COMPLETE

不羁岁月 提交于 2019-12-05 10:31:48

If your application has no activities, your BroadcastReceiver will never get called.

When you install an application, it is installed in the "stopped state". applications in "stopped state" do not get broadcast Intents delivered to them.

In order to get your application out of "stopped state", the user must manually launch your application (at least once). In order to do this, you must offer him an Activity that he can use to start your application.

Once your application is no longer in "stopped state", Android will deliver broadcast Intents to it. That is, until the user "force stops" your application.

If the user "force stops" your application, it will go back to "stopped state" and will no longer get the broadcast Intents. Until the user manually starts your application again.

I tried with am broadcast -a android.intent.action.BOOT_COMPLETED then it restart the device.

You can try <action android:name="android.intent.action.USER_PRESENT"/>

After more research, I think it was the fastboot mode which will not broadcast BOOT_COMPLETE.

Your service is filtering actions, but your intent doesn't provide any. Fix with this:

StartServiceIntent.setAction("com.tfl.extprotocolservice.IExtMessage");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!