Procházet zdrojové kódy

谷歌推送增加channel_id

peng před 2 roky
rodič
revize
3d8f60a592
2 změnil soubory, kde provedl 9 přidání a 4 odebrání
  1. 5 2
      Service/DevicePushService.py
  2. 4 2
      Service/PushService.py

+ 5 - 2
Service/DevicePushService.py

@@ -484,12 +484,15 @@ class DevicePushService:
         result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                    message_body=msg_text, data_message=data,
                                                    click_action='android.intent.action.VIEW',
-                                                   android_channel_id=1,
                                                    extra_kwargs={
                                                        'default_vibrate_timings': True,
                                                        'default_sound': True,
                                                        'default_light_settings': True
-                                                   })
+                                                   },
+                                                   extra_notification_kwargs={
+                                                       'android_channel_id': 1
+                                                   }
+                                                   )
         return result
 
     @staticmethod

+ 4 - 2
Service/PushService.py

@@ -164,11 +164,13 @@ class PushObject:
             result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
                                                        message_body=msg_text, data_message=push_data,
                                                        click_action='android.intent.action.VIEW',
-                                                       android_channel_id=1,
                                                        extra_kwargs={'default_sound': True,
                                                                      'default_vibrate_timings': True,
                                                                      'default_light_settings': True,
-                                                                     }
+                                                                     },
+                                                       extra_notification_kwargs={
+                                                           'android_channel_id': 1
+                                                       }
                                                        )
             logger.info('fcm推送结果:{}'.format(result))
         except Exception as e: