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

fix android issue api 31 and when moving to back not going to home page #579

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
23 changes: 9 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-background-mode",
"version": "0.7.3",
"version": "0.7.6",
"description": "Prevent apps from going to sleep in background.",
"cordova": {
"id": "cordova-plugin-background-mode",
Expand All @@ -12,7 +12,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/katzer/cordova-plugin-background-mode.git"
"url": "git+https://github.com/alindzon/cordova-plugin-background-mode.git"
},
"keywords": [
"appplant",
Expand All @@ -22,20 +22,15 @@
"cordova-android",
"cordova-browser"
],
"engines": [
"engines":
{
"name": "cordova",
"version": ">=3.0.0"
"cordova": ">=3.0.0",
"android-sdk": ">=16"
},
{
"name": "android-sdk",
"version": ">=16"
}
],
"author": "Sebastián Katzer",
"author": "by Sebastián Katzer forked by Andrew Lindozn",
"license": "Apache 2.0",
"bugs": {
"url": "https://github.com/katzer/cordova-plugin-background-mode/issues"
"url": "https://github.com/alindzon/cordova-plugin-background-mode/issues"
},
"homepage": "https://github.com/katzer/cordova-plugin-background-mode#readme"
}
"homepage": "https://github.com/alindzon/cordova-plugin-background-mode#readme"
}
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.7.6">

<name>BackgroundMode</name>

Expand Down
10 changes: 8 additions & 2 deletions src/android/BackgroundModeExt.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,17 @@ public boolean execute (String action, JSONArray args,
*/
private void moveToBackground()
{
Intent intent = new Intent(Intent.ACTION_MAIN);
Activity app = getApp();
app.moveTaskToBack(true);
/** Intent intent = new Intent(Intent.ACTION_MAIN);

intent.addCategory(Intent.CATEGORY_HOME);

* test without this to see if previous app goes to foreground
*intent.addCategory(Intent.CATEGORY_HOME);


getApp().startActivity(intent);
*/
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/android/ForegroundService.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private Notification makeNotification (JSONObject settings)
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_MUTABLE);


notification.setContentIntent(contentIntent);
Expand Down