Explorar o código

android fcm推送V1添加推送标题

linhaohong hai 1 ano
pai
achega
2fe46d1337
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      Service/PushService.py

+ 5 - 1
Service/PushService.py

@@ -214,12 +214,16 @@ class PushObject:
                 push_data['content_available'] = True
                 push_data['direct_boot_ok'] = True
             message = messaging.Message(
+                notification=messaging.Notification(
+                    title=msg_title,
+                    body=msg_text
+                ),
                 data=push_data,
                 token=token_val,
             )
             # Send a message to the device corresponding to the provided
             # registration token.
-            result = messaging.send(message)
+            result = messaging.send(message, dry_run=True)
             LOGGER.info('fcm推送结果:{}'.format(result))
             return True
         except Exception as e: