Giter Site home page Giter Site logo

Comments (10)

ShehanS avatar ShehanS commented on July 29, 2024 5

It's solved for me after below changes
<config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" /> </config-file>

image

from cordova-plugin-autostart.

peitschie avatar peitschie commented on July 29, 2024 2

For me, only these two permissions are necessary (Android 10 + 11)

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

Relevant notes from Android documentation:

As @ShehanS noted, the user needs to manually enable "Allow display over other apps" in the app permissions to allow this plugin to work as designed.

from cordova-plugin-autostart.

jmarshall-com avatar jmarshall-com commented on July 29, 2024 1

Thanks @ShehanS and @peitschie for their detailed answers here; they solved my problem.

I've found that the SYSTEM_ALERT_WINDOW permission is not needed-- I only needed to add RECEIVE_BOOT_COMPLETED into config.xml . This is for Android 11.

Note that the app might only auto-start a minute or more after the boot looks completed and after you unlock the screen.

from cordova-plugin-autostart.

ShehanS avatar ShehanS commented on July 29, 2024

2020-09-27 11:27:39.437 509-2022/system_process I/PackageDexOptimizer: Running dexopt (dexoptNeeded=1) on: /data/app/~~4u0wt5jDduYhqZRoBO3LSQ==/io.ionic.starter-trvTOysC86JM1N6blaqkPA==/base.apk pkg=io.ionic.starter isa=x86_64 dexoptFlags=boot_complete,debuggable,public,enable_hidden_api_checks targetFilter=verify oatDir=/data/app/~~4u0wt5jDduYhqZRoBO3LSQ==/io.ionic.starter-trvTOysC86JM1N6blaqkPA==/oat classLoaderContext=PCL[]{PCL[/system/framework/android.test.base.jar]}
2020-09-27 11:27:39.501 412-573/? V/installd: DexInv: --- BEGIN '/data/app/~~4u0wt5jDduYhqZRoBO3LSQ==/io.ionic.starter-trvTOysC86JM1N6blaqkPA==/base.apk' ---
2020-09-27 11:27:42.298 2239-2239/? I/dex2oat32: /apex/com.android.art/bin/dex2oat32 --input-vdex-fd=-1 --output-vdex-fd=9 --updatable-bcp-packages-file=/system/etc/updatable-bcp-packages.txt --resolve-startup-const-strings=true --max-image-block-size=524288 --compiler-filter=verify --debuggable --classpath-dir=/data/app/~~4u0wt5jDduYhqZRoBO3LSQ==/io.ionic.starter-trvTOysC86JM1N6blaqkPA== --class-loader-context=PCL[]{PCL[/system/framework/android.test.base.jar]} --generate-mini-debug-info --compact-dex-level=none --compilation-reason=boot
2020-09-27 11:27:52.607 412-573/? V/installd: DexInv: --- END '/data/app/~~4u0wt5jDduYhqZRoBO3LSQ==/io.ionic.starter-trvTOysC86JM1N6blaqkPA==/base.apk' (success) ---
2020-09-27 11:27:57.737 509-2022/system_process I/BackgroundDexOptService: Pinning optimized code {io.ionic.starter}
2020-09-27 11:27:57.738 509-2022/system_process D/IorapForwardingService: onPackagesUpdated: io.ionic.starter
2020-09-27 11:28:24.349 509-536/system_process I/ActivityManager: Start proc 3627:io.ionic.starter/u0a152 for broadcast {io.ionic.starter/com.tonikorin.cordova.plugin.autostart.BootCompletedReceiver}
2020-09-27 11:28:24.532 3627-3627/io.ionic.starter D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
2020-09-27 11:28:24.592 3627-3627/io.ionic.starter D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true
2020-09-27 11:28:24.607 3627-3627/io.ionic.starter D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true
2020-09-27 11:28:24.680 509-1863/system_process I/ActivityTaskManager: START u0 {flg=0x14000000 cmp=io.ionic.starter/.MainActivity (has extras)} from uid 10152
2020-09-27 11:28:24.681 509-1863/system_process W/ActivityTaskManager: Background activity start [callingPackage: io.ionic.starter; callingUid: 10152; isCallingUidForeground: false; callingUidHasAnyVisibleWindow: false; callingUidProcState: RECEIVER; isCallingUidPersistentSystemProcess: false; realCallingUid: 10152; isRealCallingUidForeground: false; realCallingUidHasAnyVisibleWindow: false; realCallingUidProcState: RECEIVER; isRealCallingUidPersistentSystemProcess: false; originatingPendingIntent: null; isBgStartWhitelisted: false; intent: Intent { flg=0x14000000 cmp=io.ionic.starter/.MainActivity (has extras) }; callerApp: ProcessRecord{1e21a9b 3627:io.ionic.starter/u0a152}]
2020-09-27 11:28:24.798 509-535/system_process W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.USER_PRESENT flg=0x24200010 } to io.ionic.starter/com.tonikorin.cordova.plugin.autostart.UserPresentReceiver
2020-09-27 11:29:15.204 509-3455/system_process I/ActivityManager: Killing 3627:io.ionic.starter/u0a152 (adj 985): empty #17

from cordova-plugin-autostart.

 avatar commented on July 29, 2024

I have the same problem.
Autostrart works with android versions < 10 only

from cordova-plugin-autostart.

Maxime145 avatar Maxime145 commented on July 29, 2024

Not working for me.

I am using the "cordova-plugin-autostart" plugin and the "@ ionic-native / autostart" package.

When I check the permissions it returns "true", so it can be assumed that the plugin is supposed to work.

But on android (10 and 11) nothing happens at startup or restart.

from cordova-plugin-autostart.

tushe avatar tushe commented on July 29, 2024

UP...

from cordova-plugin-autostart.

coderbuzz avatar coderbuzz commented on July 29, 2024

Already fixed in this PR but not merged yet @ToniKorin

from cordova-plugin-autostart.

tushe avatar tushe commented on July 29, 2024

Thanks!

from cordova-plugin-autostart.

coderbuzz avatar coderbuzz commented on July 29, 2024

Merged

from cordova-plugin-autostart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.