vbea il y a 2 ans
Parent
commit
d63f3cef9a
1 fichiers modifiés avec 16 ajouts et 15 suppressions
  1. 16 15
      Strides-APP/app/utils/notification.js

+ 16 - 15
Strides-APP/app/utils/notification.js

@@ -12,21 +12,22 @@ PushNotification.configure({
   // (必需)在收到或打开远程通知或打开本地通知时调用
   onNotification: function (notification) {
     console.log("NOTIFICATION:", notification);
-
-    if (notification.title) {
-      //TODO 处理通知
-      notification.channelId = "10186";
-      notification.smallIcon = "ic_notification";
-      notification.showWhen = true;
-      PushNotification.localNotification(notification);
-    } else if (notification.data) {
-      //TODO 处理消息
-      
-    }
-
-    //(必需)在收到或打开远程通知或打开本地通知时调用
-    if (notification.finish) {
-      notification.finish(PushNotificationIOS.FetchResult.NoData);
+    if (!isIOS) {
+      if (notification.title) {
+        //TODO 处理通知
+        notification.channelId = "10186";
+        notification.smallIcon = "ic_notification";
+        notification.showWhen = true;
+        PushNotification.localNotification(notification);
+      } else if (notification.data) {
+        //TODO 处理消息
+        
+      }
+    } else {
+      //(必需)在收到或打开远程通知或打开本地通知时调用
+      if (notification.finish) {
+        notification.finish(PushNotificationIOS.FetchResult.NoData);
+      }
     }
   },