在Android和iOS设备中推送基于用户和设备和应用程序ID组合的通知(push notification based on users with combination of device and

编程入门 行业动态 更新时间:2024-10-28 21:14:48
在Android和iOS设备中推送基于用户和设备和应用程序ID组合的通知(push notification based on users with combination of device and app id in android and iOS devices)

我们有一个现有的网站写的PHP和SQL。

我们计划为公司客户开发一个移动应用程序,该应用程序将使用自己的用户ID /密码登录移动应用程序。 每当客户达到任何里程碑时,我们都需要从php服务器向移动应用程序(Android和iOS设备)发送推送通知

我在这里有一个问题。

在客户端模块(带有pushplug-in的phonegap) - 它将从GCM服务器接收通知

因为推送通知是基于设备和应用程序ID配置的,而不是基于已记录的用户。 如果不同的用户使用相同的设备,我们需要如何实现推送通知功能? 客户是否需要配置google acount以接收从GCM服务器发送的推送通知?(因为客户将使用自己的凭据登录应用程序)

请让我知道您的建议或任何链接,这些链接将提供有关如何实现此目的的一些提示。

谢谢,Hanmayya

We have a existing web site written php and sql.

We are planning to develop a mobile app for the corporate customer which will login to mobile app using there own user id/password. Whenever a customer achieves any milestone, we need to send a push notification from the php server to mobile apps(android and iOS devices)

I have a question here.

in client module(phonegap with pushplug-in) - which will receive notification from GCM server

as push notification are configured based on device and app id not based on user who have logged. If different users are using the same device how we need to implement the push notification functionality? Do the customer need to configure google acount to receive push notification sent from GCM server?(as customer will be logging into the apps with their own credentials)

Please let me know your suggestions or any link which will give some hints on how to achieve this.

Thanks, Hanmayya

最满意答案

在移动应用程序中,您将拥有一个扩展GCMBaseIntentService的类,并将覆盖onRegistered 。

在应用程序\ device注册到GCM服务器之后,将调用onRegistered方法,通过此方法,您将调用Web服务器注册设备,您给定的GCM注册

onRegistered(Context context, String registrationId)

registrationId不是设备唯一的,并且可以在用户删除并重新安装该应用程序时更改。

因此,您需要从设备中获取其他信息,例如Android ID或更好的帐户信息(如果您需要帐户信息,则必须在清单中请求用户权限)

String deviceID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);

要支持所有平台,您可能需要检查PushSharp。

Inside your mobile application you will have an class that extents GCMBaseIntentService and will override onRegistered.

After you application\device is registered against the GCM server, your onRegistered method will be called, from this method you will make a call to your web server to register the device, your given the GCM registrationid

onRegistered(Context context, String registrationId)

The registrationId is not device unique and can change when the user remove and reinstalls that app.

For this reason you will want to grab additional information from the device, such as the android ID or better yet, Account information (You will have to request the user permission in your manifest if you want account information)

String deviceID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);

To support all platforms, you might want to check into PushSharp.

更多推荐

本文发布于:2023-08-06 18:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1454666.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组合   设备   应用程序   通知   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!