我正在使用推送服务将Notifications
发送到所有Android设备。我已使用此代码从Android设备中提取了InstanceId
public class FirebaseIDService extends FirebaseInstanceIdService {
@Override
public void onTokenRefresh() {
super.onTokenRefresh();
String tkn = FirebaseInstanceId.getInstance().getToken();
}
}
这是我的python发送Push-Notification
的代码。
def push_notify(name,description):
#method to push notification
pn_client = PushNotifications(
instance_id='fdb1f293-1c66-427d-b8a3-55fe5c6bb5a8',
secret_key='9D508EDE95F5368EC8A4132AD6F5ED260718FD2C2A950A21234532D30D9E5031',
)
response = pn_client.publish(
interests=['hello'],
publish_body={'apns': {'aps': {'alert': 'Offer Created'}},
'fcm': {'token':
['fB123456789Zo:APA91bFqUUt_AHBi_W1yC0BSjBaZcTPx_GeLnv8QYGMtPOfob12DEB3tOYkvjMv3E-xvbyk95MdkIOTNPrtGSrzd20I8AWg9p5GXLMkBAI2f55RrOOFVJJ_WxxxJFNEfMBfAsADvo0Cn'],
'notification': {'title': str(name), 'body': str(description)}}}
)
print(response['publishId'])
要求是我只想将通知发送到某些设备。如何实现