Bladeren bron

App throwed an error at restart if a callback was registered

Sebastián Katzer 12 jaren geleden
bovenliggende
commit
d3cdd7110e
2 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 2 0
      README.md
  2. 5 1
      src/android/LocalNotification.java

+ 2 - 0
README.md

@@ -47,7 +47,9 @@ More informations can be found [here](https://build.phonegap.com/plugins/413).
 
 ## Release Notes
 #### Version 0.7.1 (not yet released)
+- [bugfix:] `ongoing` attribute was ignored.
 - [bugfix:] `oncancel` wasnt fired if `autoCancel` was set to true.
+- [bugfix:] App throwed an error at restart if a callback was registered.
 
 #### Version 0.7.0 (22.01.2014)
 **Note:** The new way of callback registration will be not compatible with previous versions! See #62

+ 5 - 1
src/android/LocalNotification.java

@@ -275,7 +275,11 @@ public class LocalNotification extends CordovaPlugin {
      * Gibt an, ob die App im Hintergrund läuft.
      */
     private static boolean isInBackground () {
-        return !context.getPackageName().equalsIgnoreCase(((ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0).topActivity.getPackageName());
+        try {
+            return !context.getPackageName().equalsIgnoreCase(((ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0).topActivity.getPackageName());
+        } catch (Exception e) {
+            return true;
+        }
     }
 
     /**