Sebastián Katzer 11 rokov pred
rodič
commit
1989fd4fe6
2 zmenil súbory, kde vykonal 19 pridanie a 18 odobranie
  1. 18 17
      src/wp8/LocalNotification.cs
  2. 1 1
      www/local-notification.js

+ 18 - 17
src/wp8/LocalNotification.cs

@@ -46,7 +46,7 @@ namespace Cordova.Extension.Commands
         /// <summary>
         /// Informs either the app is running in background or foreground
         /// </summary>
-        private bool RunsInBackground = true;
+        private bool RunsInBackground = false;
 
         /// <summary>
         /// Sets application live tile
@@ -140,22 +140,6 @@ namespace Cordova.Extension.Commands
             DeviceReady = true;
         }
 
-        /// <summary>
-        /// Called when the application has been switched to background
-        /// </summary>
-        public void pause (string jsonArgs)
-        {
-            RunsInBackground = true;
-        }
-
-        /// <summary>
-        /// Called when the application has been switched to foreground
-        /// </summary>
-        public void resume (string jsonArgs)
-        {
-            RunsInBackground = false;
-        }
-
         /// <summary>
         /// Creates tile data
         /// </summary>
@@ -215,5 +199,22 @@ namespace Cordova.Extension.Commands
         {
             return RunsInBackground ? "background" : "foreground";
         }
+
+        /// <summary>
+        /// Occurs when the application is being deactivated.
+        /// </summary>
+        public override void OnPause (object sender, DeactivatedEventArgs e)
+        {
+            RunsInBackground = true;
+        }
+
+        /// <summary>
+        /// Occurs when the application is being made active after previously being put
+        /// into a dormant state or tombstoned.
+        /// </summary>
+        public override void OnResume (object sender, Microsoft.Phone.Shell.ActivatedEventArgs e)
+        {
+            RunsInBackground = false;
+        }
     }
 }

+ 1 - 1
www/local-notification.js

@@ -214,7 +214,7 @@ channel.deviceready.subscribe( function () {
 
 channel.onCordovaReady.subscribe( function () {
     channel.onCordovaInfoReady.subscribe( function () {
-        if (device.platform != 'iOS') {
+        if (device.platform == 'Android') {
             channel.onPause.subscribe( function () {
                 cordova.exec(null, null, 'LocalNotification', 'pause', []);
             });