cordova-plugin-background-mode icon indicating copy to clipboard operation
cordova-plugin-background-mode copied to clipboard

App crashes when enabling background mode on Android 12+ (target SDK level 31+)

Open Mforcen opened this issue 2 years ago • 4 comments

From Android 12 and newer, when trying to create a PendingIntent one of the following flags are required: FLAG_IMMUTABLE or FLAG_MUTABLE. The offending API call is located in the file ForegroundService.java:223.

Best regards.

Mforcen avatar Jul 12 '23 20:07 Mforcen

I've fixed the PendingIntent crash in my fork: https://github.com/Mforcen/cordova-plugin-background-mode

Best regards.

Mforcen avatar Jul 12 '23 20:07 Mforcen

Thanks, this is actually really useful. The fork can be installed using

cordova plugin add 'https://github.com/Mforcen/cordova-plugin-background-mode#2b9a4de'

jlherren avatar Jul 19 '23 09:07 jlherren

@Mforcen When you have time, it would be good if possible to upload or publish the plugin in npm so that it is available to the community, some time is usually wasted looking for how to solve the issue. I thank you very much in advance for your contribution.

wuitoonchi avatar May 03 '24 19:05 wuitoonchi

@Mforcen When you have time, it would be good if possible to upload or publish the plugin in npm so that it is available to the community, some time is usually wasted looking for how to solve the issue. I thank you very much in advance for your contribution.

Yeah! Will do as soon as I get to my computer!

Mforcen avatar May 03 '24 19:05 Mforcen

Hi @wuitoonchi, I've seen that there are already other versions of this plugin on NPM with the fix applied. Please use this, for example: https://www.npmjs.com/package/@andeo/cordova-plugin-background-mode

Mforcen avatar May 15 '24 09:05 Mforcen