最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Launching app on boot in android not working after update - Stack Overflow

programmeradmin0浏览0评论

I wrote an Android app, originally developed on Android 8.1 API 27. The App opens on boot. Now i'm trying to update the app to be compatible with Android 13 API 33, but i can not get the app to start on boot. Originally i used the method in this post How to start/ launch application at boot time Android but this does not work in the new version. I have tried using "AlarmManager" and "WorkManager" but have not managed to get it to work.

I do receive "RECEIVE_BOOT_COMPLETED" and the foregroundService starts, but the MainActivity is blocked from starting. Here is let Logcat output.

2025-02-03 13:42:23.140  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  onReceive called - Intent: android.intent.action.BOOT_COMPLETED
2025-02-03 13:42:23.140  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  Boot completed - starting BootForegroundService.
2025-02-03 13:42:23.208  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  BootForegroundService started - scheduling MainActivity launch.
2025-02-03 13:42:26.212  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  Scheduling MainActivity launch using AlarmManager.
2025-02-03 13:42:26.219  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  MainActivity scheduled to launch in 5 sec.

I wrote an Android app, originally developed on Android 8.1 API 27. The App opens on boot. Now i'm trying to update the app to be compatible with Android 13 API 33, but i can not get the app to start on boot. Originally i used the method in this post How to start/ launch application at boot time Android but this does not work in the new version. I have tried using "AlarmManager" and "WorkManager" but have not managed to get it to work.

I do receive "RECEIVE_BOOT_COMPLETED" and the foregroundService starts, but the MainActivity is blocked from starting. Here is let Logcat output.

2025-02-03 13:42:23.140  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  onReceive called - Intent: android.intent.action.BOOT_COMPLETED
2025-02-03 13:42:23.140  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  Boot completed - starting BootForegroundService.
2025-02-03 13:42:23.208  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  BootForegroundService started - scheduling MainActivity launch.
2025-02-03 13:42:26.212  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  Scheduling MainActivity launch using AlarmManager.
2025-02-03 13:42:26.219  1985-1985  ServerDebug             dk.wk.abainfovarsling                I  MainActivity scheduled to launch in 5 sec.
Share Improve this question edited Feb 3 at 13:38 XerXeX asked Feb 3 at 13:30 XerXeXXerXeX 7924 silver badges19 bronze badges 1
  • Please be more specific on your problem, is the RECEIVE_BOOT_COMPLETED broadcast receiver not being fired or are you trying to do something else too? – tyczj Commented Feb 3 at 13:33
Add a comment  | 

1 Answer 1

Reset to default 0

I do receive "RECEIVE_BOOT_COMPLETED" and the foregroundService starts, but the MainActivity is blocked from starting

Background activity starts have been banned for several years except in limited scenarios.

I have tried using "AlarmManager" and "WorkManager" but have not managed to get it to work.

Those would also qualify as banned background activity starts.

i'm trying to update the app to be compatible with Android 13 API 33, but i can not get the app to start on boot

Have your app be the designated launcher (<intent-filter> for the MAIN action and HOME category).

发布评论

评论列表(0)

  1. 暂无评论