How to make a Push Notification opens a specific uiview - iphone

I've been trying forever to get this to work, when I send a push notification to my app. When the user opens it, it just takes them to the app. I want to direct them to a specific uiview, how do I do that?

The method application:didReceiveRemoteNotification: is called if your app is running (whether in the background or not).
So that would be the starting point to direct them to the specific UIView.
You can tell whether your app was just brought to the foreground or not in the code in the following answer
Hope this helps .

Related

How to detect whether user didEnterBackground because of phone call or click on home button?

We have a multiplayer game and sometimes user quit the game so we would like to know how did user quit the game. Can we use didEnterBackground for that?
We would like to know whether user quit the game by clicking exit button, or by incoming call, or by home button to exit.
When you press home button your application is sent to background and applicationDidEnterBackground will get call first and if it is by call, sms then applicationWillResignActive will get call first.
This is not perfect answer of your question but this might help you in some.
in the appDelegate.m File u have this function:
- (void)applicationDidEnterBackground:(UIApplication *)application
write the code you want in it. (saving data or anything)
First of all, the user interface guidelines forbid quitting an app programmatically and based on what I have read, apps the provide an exit button will be rejected.
If by 'quit the game' you mean something along the lines of 'terminated gameplay', then that should not be a problem.
Also note that pressing the home button does not exit the app. It simply sends it to the background. There does not appear to be any facility to detect why the app left the foreground, which probably means that Apple wants your app to handle all such cases in the same way: by saving state and being prepared to restart where execution left off. Note that an application in the background can be terminated at any time, hence the need to save state.
The answer to your question therefore would seem to be: don't do that.

IOS 5 Local Notifications While in Foreground, is there a way

On IOS 5, we now have the notification bar on top to put messages. I have seen that Local Notifications will only happen if the app is in the background (not sure when queued, and / or when the notification is to fire, assume the latter).
Is there any way to put notifications in the notification bar while the app is in the foreground?
From my understanding, your app will be notified of a local notification while the app is running in the application:didReceiveLocalNotification delegate method, but a banner will not be shown at the top of the device screen, not will an entry be put in Notification Center. Your app is notified however, and this is so you can show your own UI for the notification in the app, or choose to ignore it.
Notification Center is only for notifications that you're missed because the app is not in the foreground, and that's why they disappear when the app is opened.
Yes, local notifications work with the simulator. However, make sure you are implementing application:didreceiveLocalNotification in your app delegate if you want to see the nofication while your app is in the foreground (source)
further troubleshooting steps per our conversation in chat and based on the above.
Like i said there are only 2 possibilities of why its not working. placement (in app delegate vs another class) and the application variable. so if it works in the app delegate then im not sure how to resolve that other then making a public method that you can reach from the class you want the notification to come from. probably not the most elegant or proper way but i dont know what else to say.
If its the application variable then make sure you use the same one i posted, application from the applicationfinishloading arguments list vs [[shared application]

NSLocalNotification - show notification animation when the app is running in iOS5

Is it possible to show NSLocalNotification when the app is running and in the foremost position? As the Apple document says when the app is in the foremost position the notification will not be shown (it shows in notification center though, just doesn't have the flipping animation on top), then what's the point for method presentLocalNotificationNow: ?
You have to use your own UI to present notifications when your app is active. Use UIApplicationDelegate's application:didReceiveLocalNotification: method to find out when a notification is posted.
Notifications are designed to be triggered when the app is no longer active. And by default, they are suppresed if your app is active. So if you tell it to trigger Now, it won't because it won't display any notifications. For something immediate while your app is active, you would use alerts. I don't believe you will be able to override this default behavior.

How to ignore a local notification when iPhone is locked?

I am implementing a voip app for iphone. Upon receiving an incoming call, the app shows a local notification with two buttons : close and answer. If the user clicks on answer, the app shows in foreground and the call is answered, and if she clicks on 'close', the call is ignored.
The problem, however, is that when iphone is locked, there is no 'close' button, only a slider for which sliding from left to right means 'answer'. Hence there is no way to ignore the call.
Is there a way to solve this? The only solution I found so far is to show another notification for the user to answer or reject, but that seems inconvenient to use.
Re-locking the screen (using the sleep/lock button) usually constitutes ignoring a notification. Have you tested whether your app receives some kind of message when that happens?

can we return back to app without tapping it again?

HI
can we open our app without tapping it again on its home icon.
I am making a call in a addressbook app and when call is made than it call the phone app than is it possible after calling we can call our app again without tapping on it after the call is ended.
Sample code will be more helpful.
thanks
Short answer - no, once you leave your app, user has to return there.
I'm not 100% sure what you are asking, but if this is what you are shooting for:
a) Your app is running, and it causes a phone number to be dialed.
b) After the call is complete, your app is automatically re-launched.
Then no, this is not possible.