Android 使用pusher和firebase无法从python脚本获取推送通知
我正在开发智能门铃android应用程序。我用的是esp32。我想要一个系统,当我按下按钮时,它会向android应用程序发送通知。当我按下与ESP32连接的硬件按钮时,我在firebase上获得的状态为Bell_Notification_状态为True或False 我还使用Pusher中的instance运行curl命令来检查通知。但是,我并没有收到来自python脚本的推送通知。我正在使用Pycharm 2018.3.7Android 使用pusher和firebase无法从python脚本获取推送通知,android,firebase,push-notification,pycharm,pusher,Android,Firebase,Push Notification,Pycharm,Pusher,我正在开发智能门铃android应用程序。我用的是esp32。我想要一个系统,当我按下按钮时,它会向android应用程序发送通知。当我按下与ESP32连接的硬件按钮时,我在firebase上获得的状态为Bell_Notification_状态为True或False 我还使用Pusher中的instance运行curl命令来检查通知。但是,我并没有收到来自python脚本的推送通知。我正在使用Pycharm 2018.3.7 import pyrebase from pusher_push_no
import pyrebase
from pusher_push_notifications import PushNotifications
config = {
'apiKey': "******",
'authDomain': "project.firebaseapp.com",
'databaseURL': "https://project.firebaseio.com",
'projectId': "project",
'storageBucket': "project.appspot.com",
'messagingSenderId': "ID",
'appId': "*********",
'measurementId': "******"
}
firebase = pyrebase.initialize_app(config)
db = firebase.database()
beams_client = PushNotifications(
instance_id='ID',
secret_key='KEY',
)
def stream_handler(message):
print(message)
if(message['data'] == 1):
response = beams_client.publish_to_interests(
interests=['hello'],
publish_body={
'apns': {
'aps': {
'alert': {
'title': 'Hello',
'body': 'Hello, world!',
},
},
},
'fcm': {
'notification': {
'title': 'Hello',
'body': 'Hello, world!',
},
},
'web': {
'notification': {
'title': 'Hello',
'body': 'Hello, world!',
},
},
},
)
print(response['publishId'])
my_stream = db.child("Bell Notification_Status").stream(stream_handler, None)