|
@@ -167,24 +167,17 @@ class PushObject:
|
|
|
push_data['priority'] = 'high'
|
|
|
push_data['content_available'] = True
|
|
|
push_data['direct_boot_ok'] = True
|
|
|
- result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
|
|
|
- message_body=msg_text, data_message=push_data,
|
|
|
- sound='android.resource://com.ansjer.zccloud_a/raw/phone_call',
|
|
|
- click_action='android.intent.action.VIEW',
|
|
|
- extra_kwargs={'default_sound': True,
|
|
|
- 'default_vibrate_timings': True,
|
|
|
- 'default_light_settings': True,
|
|
|
- },
|
|
|
- )
|
|
|
+ sound = 'android.resource://com.ansjer.zccloud_a/raw/phone_call'
|
|
|
else:
|
|
|
- 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',
|
|
|
- extra_kwargs={'default_sound': True,
|
|
|
- 'default_vibrate_timings': True,
|
|
|
- 'default_light_settings': True,
|
|
|
- },
|
|
|
- )
|
|
|
+ sound = None # 其他事件类型默认铃声
|
|
|
+ result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
|
|
|
+ message_body=msg_text, data_message=push_data, sound=sound,
|
|
|
+ click_action='android.intent.action.VIEW',
|
|
|
+ extra_kwargs={'default_sound': True,
|
|
|
+ 'default_vibrate_timings': True,
|
|
|
+ 'default_light_settings': True,
|
|
|
+ },
|
|
|
+ )
|
|
|
LOGGER.info('fcm推送结果:{}'.format(result))
|
|
|
return True
|
|
|
except Exception as e:
|