start Activity at startup of phone in android

后端 未结 2 1870
陌清茗
陌清茗 2021-01-23 03:13

I am trying to start activity at start up of phone but whole program is not running there is a no error in program , see my coding bellow(or here http://pastebin.com/BKaE4AaU):<

相关标签:
2条回答
  • 2021-01-23 03:25

    So when device boots up you'd like your activity to pop-up and show itself to the user without user's action?

    Please don't do that - that's a very bad UX practice. Do you know of any existing apps that do that? I don't know of any. I personally would not use such app.

    If you need to notify user about something then use the system preferred way - notifications.

    0 讨论(0)
  • 2021-01-23 03:38

    Your XML should be stored in a file named AndroidManifest.xml, not manifest.java.

    Another reason your code is not being run, might be that your App is installed on external storage (sdcard). BOOT_COMPLETE is sent to applications before external storage is mounted. So if application is installed to external storage it won't receive BOOT_COMPLETE broadcast message.

    If that isn't the problem, there is already a very good description of how to get boot completed receivers working on Android.

    0 讨论(0)
提交回复
热议问题