Push notification seen when I background the app - iphone

I'm seeing something very strange, and I'm hoping someone here can help me. Anytime I close/background my iOS app, the last push notification sent to that app via UrbanAirship pops-up at the top of the screen.
I've setup push notifications for my iOS app using UrbanAirship, and its associated libraries. I'm using the latest library from UA (1.3.3), and I believe I've configured everything correctly. I've gone over the basic documentation multiple times, and I'm not doing anything out of the ordinary that I can tell.
In my AppDelegate, I'm not doing anything with the UA libraries in the functions applicationWillResignActive or applicationDidEnterBackground, so I'm not certain why backgrounding the app would trigger this notification to come up. The documentation doesn't state that anything needs to happen in those functions. In the function applicationWillTerminate, I am correctly calling [UAirship land], but this issue isn't popping up when the app is terminated.
More data: I'm not actually seeing a new notification in the Notification center on my phone. I'm just seeing the message pop-up again, as if it were new.
This issue is perplexing, and if anyone can offer some insight or assistance with it, I'd appreciate it.

Related

Strange push notification behaviour

I'm dealing with the apple push notifications.
First point: they're working, and that's fine :) (I followed this tutorial as kikstart: http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1)
Second point: when I push a notification from the server, my phone is receiving an alert (I'm talking when the app isn't running) for each notification I didn't 'open'.
Is this a default behaviour?
If this is not a default behaviuor I'll add some code and particulars about all the system I'm working with, but before writing tons of information I would like to understand if this behaviour is a bug.
Thanks!

How to keep user notified that application is running in background?

Since few days i am searching for the functionality which will allow me keep user posted that application is running in background. I have attached a !image for what exactly i am looking for. i tried googling but could not get exactly what I need. when i tap on the flashing red bar it takes me back to the application.
Thanks in advance.
The red banner you pictured is provided by the system, is shown only if your application uses background audio recording (see AVAudioSession), and doesn't provide the opportunity for you to choose what happens when the user taps it.
Unless your app fits into one of a few specific classes, it doesn't actually "run" while in the background. Instead, it's "suspended" -- still in memory, but gets no CPU time. What happens outside of your app is thus up to the system, not to you... the only way to show a banner that will launch your application is to use a push notification service or UILocalNotification, but those banners are only shown briefly, and you don't get to control their duration. What you seem to be specifically asking for isn't possible using public API.
The kind of notification you want isn't supported by the current iOS for third-party developers.
If you want that kind of functionality then implement Apple Push Notification service through
this you can first give message to Apple push notification service. then Apple service
automatically generate notification for your App as you want.

Incoming call wakes iOS background App?

is it possible to wake an App in the background up, when a call comes in, and access CoreTelephony to send some infos over the web?
I'm practically a n00b in iOS development right now, but got asked a question if iOS is capable to do this. I searched in the iOS reference too, but with no luck.
It would be great if someone with more experience could answer it. Thanks a lot!
Steno
Please, have a look at the document about executing code in the background.
If you go to section "Implementing a VoIP Application", you will see that it is actually possible for your app to be awaken periodically so that it can check if it has anything to do (in your case, if I understand you correctly you would use CTCall to check for calling state).
So, basically, when awaken, your app could check for any incoming call and then use Core Telephony, as you say.
The only trouble about this is that if your app cannot be considered to a a VOIP app, Apple will not let it into the App Store.
It is not possible to have your code run when a call is received.

Retrieving latest Push Notification if app was not launched by hitting the 'View' button

I'm wondering if there is any way of retrieving the last-received push notification if the app is launched from the home screen instead of by pressing the 'View' button on the notification.
The app we're writing is for dealing with sensitive data, and it's important to be able for the central server to be able to remotely disable a client at will, without having the requirement that the app needs an internet connection to launch.
The basic idea I came up for this would be to send a push notification with a custom payload letting the app know to disable itself until it can properly sync its data.
This would work if the user pressed View on the notification, but not if they cancelled it and then launched the app separately.
I'd love to know if this is possible, or otherwise if there's a better way to implement this functionality.
It's not possible. Your app would have to connect to the server on launch and get its latest status from there. If your use case is that sensitive, push notifications are probably not reliable enough anyway because Apple does not guarantee that a push notification will actually be delivered.
Like Ole said, not possible.
Note that you shouldn't be relying on push notifications for anything like this. From Apple's push notifications programming guide:
Remember that delivery of notifications is “best effort” and is not guaranteed.

Question regarding iphone allowance of custom notifications

I have an app that I am working on, and part of its main functionality is to alert the user to do something. So even though they aren't in the app, I want to be able to pop up an alert from the app, reminding them to do something. Is that allowed with the iPhone sdk? Maybe it isn't even a big deal at all, but for some reason I was thinking that it would require background processes or something that may or may not be possible. Anyone who has any thoughts about how this would be implemented would be greatly appreciated. Thanks!
Check out the Apple documentation on push notifications. Short of jailbreaking and distributing your app outside the App Store, there is no way to run background processes at this time.
It is allowed through notifications, though you will need a server to actually send the notifications to the user. There is no limit to the number you can send, although the user may very well decide to shut off notifications or delete your app altogether if you are too spastic with them. Make very sure the user understands the notification volume they will receive and agrees to it...
The way the system works is the user gets a notification message (and/or sound) and can decide to open your app or not, as the time of notification.