简体   繁体   English

OnsenUI:推送通知

[英]OnsenUI: push notification

Is there any way to send a notification from the app, without using 'Push.send()' on the back-end? 有什么方法可以从应用程序发送通知,而无需在后端使用“ Push.send()”? I have a simple app, with use a timer and when the time ends I need to notify the user if he is not using the app at that moment. 我有一个简单的应用程序,带有一个计时器,当时间到时,如果他当时不使用该应用程序,我需要通知用户。

Thanks! 谢谢!

I think there is no way to send push notification from PhoneGap app itself. 我认为无法从PhoneGap应用本身发送推送通知。

Instead of Push Notification, you can adopt "Local Notification". 您可以采用“本地通知”代替推送通知。 In case Android, you need to use AlarmManager and NotificationManager to send notification locally. 如果是Android,则需要使用AlarmManager和NotificationManager在本地发送通知。

http://developer.android.com/reference/android/app/AlarmManager.html http://developer.android.com/reference/android/app/AlarmManager.html

http://developer.android.com/reference/android/app/NotificationManager.html http://developer.android.com/reference/android/app/NotificationManager.html

However, in case PhoneGap app these native API can not be accessed from JavaScript. 但是,以防PhoneGap应用无法从JavaScript访问这些本机API。 You need to embed PhoneGap plugin which enables JavaScript to access these native API. 您需要嵌入PhoneGap插件,该插件使JavaScript可以访问这些本机API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM