diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/cordova-plugin-local-notification-12.iml b/.idea/cordova-plugin-local-notification-12.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/cordova-plugin-local-notification-12.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..0eefe32 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..d23208f --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f332b1d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 86844c9..d2dad3a 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,13 @@ #### Important notice -If the app is in background, it must not be launched but put in foreground. +If the app is in background, it must not be launched but put in foreground. To avoid launching the app in this case, add the following in your config.xml file: -`` +`` + +Not need anymore, and it's better to avoid because it can cause issues with the cordova camera plugin. +See https://stackoverflow.com/questions/10831562/camera-always-returns-resultcode-as-0 + #### To install diff --git a/src/android/notification/Builder.java b/src/android/notification/Builder.java index 1a56606..61c49bb 100644 --- a/src/android/notification/Builder.java +++ b/src/android/notification/Builder.java @@ -427,7 +427,7 @@ private void applyContentReceiver(NotificationCompat.Builder builder) { } PendingIntent contentIntent = - LaunchUtils.getTaskStackPendingIntent(context, intent, notificationId); + LaunchUtils.getActivityPendingIntent(context, intent, notificationId); builder.setContentIntent(contentIntent); } @@ -474,7 +474,7 @@ private PendingIntent getPendingIntentForAction (Action action) { intent.putExtras(extras); } - return LaunchUtils.getTaskStackPendingIntent(context, intent, notificationId); + return LaunchUtils.getActivityPendingIntent(context, intent, notificationId); } /** diff --git a/src/android/notification/util/LaunchUtils.java b/src/android/notification/util/LaunchUtils.java index 19d3998..5a20de0 100644 --- a/src/android/notification/util/LaunchUtils.java +++ b/src/android/notification/util/LaunchUtils.java @@ -1,7 +1,6 @@ package de.appplant.cordova.plugin.notification.util; import android.app.PendingIntent; -import android.app.TaskStackBuilder; import android.content.Context; import android.content.Intent; @@ -34,15 +33,6 @@ public static PendingIntent getActivityPendingIntent(Context context, return PendingIntent.getActivity(context, notificationId, intent, getIntentFlags()); } - public static PendingIntent getTaskStackPendingIntent(Context context, - Intent intent, - int notificationId) { - TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context); - taskStackBuilder.addNextIntentWithParentStack(intent); - return taskStackBuilder.getPendingIntent(notificationId, getIntentFlags()); - } - - /*** * Launch main intent from package. */