gpt4 book ai didi

java - 在模拟器之间发送通知

转载 作者:行者123 更新时间:2023-12-01 14:41:22 24 4
gpt4 key购买 nike

正如一个人已经问过的那样,我想知道是否有人可以帮助我们在两个模拟器之间发送和接收通知。例如,有一个函数发送通知,但不是发送到同一个模拟器(例如 5554),而是发送到另一个模拟器(例如 5556),以便接收者可以检查通知并触发 onClick 监听器 接受或拒绝通知

NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.ic_launcher,msg,System.currentTimeMillis());
notification.setLatestEventInfo(this, msg, details, null);
int num = 0;
manager.notify(num, notification);

最佳答案

通知无法发送到其他设备,您只能通过您的应用通知自己的设备。如果您想在另一台设备上显示任何通知,您必须在另一台设备上运行的应用程序中为其编写代码,并使用短信或某些网络服务或推送消息系统触发通知。

如果您想与其他设备通信以获取通知..使用PUSHMESSAGE..检查GCM http://developer.android.com/google/gcm/index.html

关于java - 在模拟器之间发送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15925200/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com