Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create service de.appplant.cordova.plugin.background.ForegroundService, IllegalArgumentException. #4897

Open
1 of 3 tasks
AhmadAbdallah13 opened this issue Jan 3, 2025 · 0 comments

Comments

@AhmadAbdallah13
Copy link

I'm submitting a ... (check one with "x")

Current behavior:
SDK 31 PendingIntent flag error, Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.

Exact error:

java.lang.RuntimeException: Unable to create service de.appplant.cordova.plugin.background.ForegroundService: java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.

Expected behavior:
This error is already handled in the source plugin repo and should be updated here.

Other information:
I don't know if this helps but since i am in a capacitor project i added the cordova plugins using npm as below:

npm install cordova-plugin-background-mode
npm install @awesome-cordova-plugins/background-mode
npm install cordova-plugin-device

then had to do
npm uninstall cordova-plugin-background-mode
in order to add the plugin code directly from its repo, and it worked correctly after that.
npm install https://github.com/katzer/cordova-plugin-background-mode.git

Ionic info:

Ionic:

   Ionic CLI                     : 7.2.0 (/Users/ahmad/.nvm/versions/node/v23.0.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 8.4.1
   @angular-devkit/build-angular : 18.2.12
   @angular-devkit/schematics    : 18.2.12
   @angular/cli                  : 18.2.12
   @ionic/angular-toolkit        : 11.0.1

Capacitor:

   Capacitor CLI      : 6.2.0
   @capacitor/android : 6.2.0
   @capacitor/core    : 6.2.0
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : 2.0.1

System:

   NodeJS : v23.0.0 (/Users/ahmad/.nvm/versions/node/v23.0.0/bin/node)
   npm    : 10.9.0
   OS     : macOS Unknown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant