mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2024-11-14 03:24:54 +00:00
Fix for PendingIntent mutability and AndroidX
This commit is contained in:
parent
b33044c8e5
commit
8bc19edeb4
@ -1,4 +1,9 @@
|
||||
## ChangeLog
|
||||
|
||||
#### Version 0.8.0
|
||||
- Set PendingIntent mutability (fixes #45)
|
||||
- Depend on cordova-androidx-build to automatically work with AndroidX
|
||||
|
||||
#### Version 0.7.3 (not yet released)
|
||||
- Check if screen is off on Android
|
||||
- Wake-up device on Android
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-plugin-background-mode",
|
||||
"version": "0.7.3",
|
||||
"version": "0.8.0",
|
||||
"description": "Prevent apps from going to sleep in background.",
|
||||
"cordova": {
|
||||
"id": "cordova-plugin-background-mode",
|
||||
|
@ -3,7 +3,7 @@
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="cordova-plugin-background-mode"
|
||||
version="0.7.3">
|
||||
version="0.8.0">
|
||||
|
||||
<name>BackgroundMode</name>
|
||||
|
||||
@ -94,6 +94,7 @@
|
||||
target-dir="src/de/appplant/cordova/plugin/background" />
|
||||
|
||||
<framework src="com.android.support:support-compat:27.1.1" />
|
||||
<dependency id="cordova-androidx-build" />
|
||||
<resource-file src="src/android/res/drawable/power.xml" target="res/drawable/power.xml" />
|
||||
<resource-file src="src/android/res/drawable-hdpi/power.png" target="res/drawable-hdpi/power.png" />
|
||||
<resource-file src="src/android/res/drawable-mdpi/power.png" target="res/drawable-mdpi/power.png" />
|
||||
|
@ -215,7 +215,7 @@ public class ForegroundService extends Service {
|
||||
if (settings.optBoolean("allowClose", false)) {
|
||||
|
||||
final Intent clostAppIntent = new Intent("com.backgroundmode.close" + pkgName);
|
||||
final PendingIntent closeIntent = PendingIntent.getBroadcast(context, 1337, clostAppIntent, 0);
|
||||
final PendingIntent closeIntent = PendingIntent.getBroadcast(context, 1337, clostAppIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||
final String closeIconName = settings.optString("closeIcon", "power");
|
||||
NotificationCompat.Action.Builder closeAction = new NotificationCompat.Action.Builder(getIconResId(closeIconName), settings.optString("closeTitle", "Close"), closeIntent);
|
||||
notification.addAction(closeAction.build());
|
||||
@ -240,7 +240,7 @@ public class ForegroundService extends Service {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
PendingIntent contentIntent = PendingIntent.getActivity(
|
||||
context, NOTIFICATION_ID, intent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent.FLAG_UPDATE_CURRENT & PendingIntent.FLAG_IMMUTABLE);
|
||||
|
||||
|
||||
notification.setContentIntent(contentIntent);
|
||||
|
Loading…
Reference in New Issue
Block a user