开发者

Push Notification Alert Handling

开发者 https://www.devze.com 2023-02-03 07:01 出处:网络
I have a 开发者_Go百科doubt. I am building an application wherein if there is a new request is submitted I am getting a push notification in my application and on tap of \"View\" button in the push no

I have a 开发者_Go百科doubt. I am building an application wherein if there is a new request is submitted I am getting a push notification in my application and on tap of "View" button in the push notification alert I need to show the request detail page. Now, normally this request detail page is 5th view in the stack. How should I handle this? Should I initialize first 4 views and put them on the stack before going to the detail page?

Also, there is a scenario where if someone is working on some part of the app and notification comes up. In that should I loose the changes on the currently opened page and show the request details if "View" was tapped on?

How should I handle this?


You can just push that view (the usual 5th view). The only thing is that when you pop that view, it will now act as the 2nd view, so theres no need to go through 4 additional views.


You can initialize and push the 5 views to your navigation controller (with animate:NO) to start the app up in the right place.

As for if you get a notification while running, that's really up to you and what is best for the app. You can always prompt the user before deleting any data. Note that if you get a push notification, your application:didReceiveRemoteNotification: instead of the alert showing.


This is commonly achieved by displaying the controller modally.

This way you don't have to recreate your view-controllers hierarchy and you don't lose the current context of your app if it was running. The user taps some "OK" button and returns to the previous screen.


For the first part of your question: if you have created your view in a decoupled way, that is, if it is not dependent on the 4 other views - i suppose then you can show this view without problems. Obviously the answer really depends whether your business rules allow this.

As for the second part of your question: you always can show an UIAlertView to your users asking whether they want to take action on the received push notification.

However - i think these problems really do not have anything to do with the nature of the push notifications, and you really should loose the "I have a doubt on push notification" part of your question :) ....

Hope this helps :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号