7

我想为应用程序(iOS 和 Android)实现推送通知,并且需要对以下场景进行说明。

我了解推送通知的一般工作原理和限制。我确实阅读了文档,但这只是让我感到困惑并且没有回答我所有的问题。

在 iOS 和 Android 中如何处理以下场景:

  • 当设备关闭时
  • 当设备未连接到 3G 或 Wifi 网络时
  • 当设备崩溃并需要重新启动时
  • 当应用程序在前台时
  • 当应用程序在后台时
  • 当用户当前正在使用应用程序时
  • 当我的应用程序关闭时(未打开/启动)
  • 当推送通知是用户特定的并且两个用户共享相同的设备和应用程序时。示例:如果夫妻共享同一设备,并使用带有推送通知的银行 App。
  • 如果设备由多个用户共享,您可以发送用户特定通知吗?
  • 当用户在多台设备上安装了 App
  • 您可以一次向用户注册的所有设备发送通知吗?
  • 您是否将设备类型(iOS 或 Android)与 registrationID 存储在 User 表中,或者有没有办法通过检查令牌或 registrationID 来区分设备类型?
  • 您可以取消之前发送的尚未阅读的通知并发送新通知吗?
  • Android Push Notifications 在 Kindle Fire 上不起作用并且需要实施 Amazon Device Messaging 仍然是真的吗
  • 还有什么我需要考虑或计划的吗?我知道处理注销和反馈服务
4

2 回答 2

3

When the device is turned off:

Answer: IOS/Android Server (Not your Server) will handled when to send the Push Notification. It checks that device is reachable or not. We can define that how many times IOS/Android Server should try to send Push Notification.

When the device is not connected to 3G or Wifi networks

Answer: Nothing related to 2G/3G/Wi-Fi. Device should be connected to Internet via any network.

When the device has crashed and need restart

Answer: IOS/Android Server checks that device is reachable or not.

When the App is in foreground

Answer: Nothing related to app in foreground.

When the App is in the background

Answer: Nothing related to app in background.

When user is currently using the App

Answer: Nothing related to app being used currently.

When my app is closed (not opened / launched)

Answer: Nothing related to app is closed.

When a push notification is user specific and both users share the same device and app. Example: If a husband and wife share same device and use a bank App with Push notification.

Answer: It depends on how you have implemented on YOUR Server. You will be managing Device Id for each user. So it's upto your implementation logic to send to same device for multiple users.

Can you send User specific notification if device is shared by multiple users?

Answer: It depends on how you have implemented on YOUR Server. You will be managing Device Id for each user. So it's upto your implementation logic.

When user has installed App on multiple devices

Answer: It depends on how you have implemented on YOUR Server.

Can you send a notification to all devices registered by a user at once?

Answer: Yes again as per your implementation logic.

Do you store the device type (iOS or Android) with the registrationID in the User table or is there a way to differentiate the type of device by inspecting the token or registrationID?

Answer: Yes you need to store the device type, to identify to which Server (IOS/Android), you need to send request for Push Notification.

Can you cancel a previously sent notification which is not read yet and send a new one?

Answer: No you cannot cancel the request.

Is it still true that Android Push Notifications does not work on Kindle Fire and will need to implement Amazon Device Messaging

Answer: Need to google it around.

Anything else that I need to think of or plan? I am aware of handling un-registering and feedback service

Answer: Need to google it around.

于 2013-06-28T05:39:52.883 回答
3

我会回答你的一些问题,具体到 android 思想。不知道 iPhone 是否是同类产品。

  1. 设备在服务器触发通知时从 Google Cloud 服务器接收通知,并且它与应用程序状态(运行、关闭、后台或前台)没有任何关系。
  2. 如果通知在设备未连接到互联网(关闭或未连接到网络)时发送到设备,则只有在连接到网络时才会收到通知。但是,如果收到通知后设备崩溃并重新启动,您将不会再次收到通知。

它是用户特定的吗?

这取决于各个服务器的实现。

我们存储设备类型吗?

我们可以。

我们可以区分 iPhone 和 android 的 ID 吗?

是的,android 设备 ID 的长度比 iPhone 的长。

我们可以取消已经发送的通知吗?

不,据我所知,这是一种单向沟通渠道。

于 2013-06-28T05:32:09.930 回答