Ger*_*rgo 5 android backend push-notification kotlin ktor
我用 Ktor 框架为 Android 应用程序制作了一个后端,我的问题是:
如何从服务器向手机发送推送通知?我可以使用什么工具来实现此目的?
我想发送每个人都会收到的通知,并且只有给定的用户才会收到。
我对 Ktor 不熟悉,但我这个项目的目标是学习。
nar*_*dpr -4
使用推送通知,例如:
import com.pusher.pushnotifications.PushNotifications;
Run Code Online (Sandbox Code Playgroud)
然后在应用程序生命周期的适当时刻注册设备令牌,并为您的设备订阅兴趣问候:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PushNotifications.start(getApplicationContext(), "YOUR_INSTANCE_ID");
PushNotifications.addDeviceInterest("hello");
}
Run Code Online (Sandbox Code Playgroud)
如果您没有那么多经验,这非常方便
| 归档时间: |
|
| 查看次数: |
1143 次 |
| 最近记录: |