RemoteNotification TOKEN not received if push notifications are not allowed - air

Really confused with this one!
I have an Adobe AIR iOS app and I am using the RemoteNotifier to subscribe for PushNotifications. More details http://www.adobe.com/devnet/air/articles/ios-push-notifications.html
I have the following listeners.
remoteNotifier.addEventListener(RemoteNotificationEvent.TOKEN, onToken);
After I reset my iPod to factory settings and reinstall my app (using the adhoc distribution), I click "Don't allow" for the pushnotifications when I get prompted.
I find that I then don't receive any RemoteNotificationEvent.TOKEN, so my app basically hangs waiting for that.
If I go to my Settings, Notifications and have a play with
Toggle Alert Style from the None to Alerts AND
Then back to None again (as it was)
I find that I can go back and launch my app with not problems. It's just that on the very first time user flow, I don't seem to get any TOKEN back.
Any ideas? Has anybody else seen this behaviour?
Or knows how I should handle this?
Thanks!

Hopefully I am correct, someone please correct me if I'm wrong.
From what I am able to find out, you won't get a RemoteNotificationEvent.TOKEN when the user clicks on "Don't Allow".
For some reasons that I am still unclear about, how after you play with the Settings and relaunch the app, you get the RemoteNotificationEvent.TOKEN, regardless of the notification settings you have set. But maybe that's the way it's meant to be?
So, really I have to change the flow such that I don't wait on that RemoteNotificationEvent.TOKEN before loading my first screen. If the TOKEN comes back, it comes back, otherwise if it doesn't, it's not a big deal as that means the user clicked on "Don't allow" and we don't need to send PUSH notifications anyway.
Everytime I relaunch my app, I do make the call to subscribe and get the TOKEN though, such that if the user was to enable the Notifications in the phone's Settings, I do have a TOKEN ID to send the push notification too.
The only problem I see with this though, is that should the user change the Notification to ON via the phone Settings and doesn't relaunch the app (to retrieve the TOKEN) then the device doesn't get push notifications.
Not sure how to handle this?

Related

Expo/React Native : A Continuous Alarm or Sound Notification (like receiving a call ) triggered by remote server

I am using Expo to build an app that will pop up a notification with custom sound and vibration when triggered remotely. The alarm/vibration would play until its dismissed by the user or it times out (say after 1-2 mins) .
Example use case would be when a partner needs my immediate help with baby, they can press a button the app and that would send signal to backend server which would then trigger the notification with alarm on the app at the other end. When the notification is dismissed, an acknowledgement message is sent with Yes or No type message. If the notification times out, then another message is sent like "no response".
Key point to note is that when the app is fully closed, the notification should still be able to pop up.
From my limited understanding , expo notification or push notifications in general cannot achieve this as they don't allow us to create notifications that directly open the app. Even a solution which works like phone or video calling apps (which open when someone calls you ) could work.
Any help would be much appreciated.
Many Thanks!
I looked up expo push notifications but they are limited in terms of customising the notifications.

ToastNotification during Quiet Time

I have developed a desktop application which displays ToastNotifications while the user is in Metro Mode. When clicked it will bring the user back to the desktop mode where a standard desktop notification is presented.
This all works fine except when Windows is in QUNS_QUIET_TIME. The desktop notifications do not get displayed as expected, but the ToastNotfications still get displayed. My client wishes for the ToastNotifications to not display during Quiet Time.
The code calls SHQueryUserNotificationState which returns a QUERY_USER_NOTIFICATION_STATE enumeration. The provided link says the following:
Note that during quiet time, if the user is in one of the other blocked modes (QUNS_NOT_PRESENT, QUNS_BUSY, QUNS_PRESENTATION_MODE, or QUNS_RUNNING_D3D_FULL_SCREEN) SHQueryUserNotificationState returns only that value, and does not report QUNS_QUIET_TIME.
This is what I am experiencing. The call to SHQueryUserNotificationState is returning QUNS_APP (A Windows Store app is running.) and not QUNS_QUIET_TIME.
Does anyone know of another way to determine if QUNS_QUIET_TIME is in effect or a way to force the toast to respect quiet time?
Desktop notifications use different settings than toast notifications. You can find toast notification settings here. When a user sets notifications to one hour from Windows 8 Settings | Notifications, the app will not be able set toast notification. Try the example "sending toast notifications from a desktop" here (either C++ code or C# code).

Long-running task performed in foreground is suspended when app enters background

When a user first opens my app, I need to download and install some content from a server before they can begin using the app. The problem is that this takes around 5 minutes on wifi, during which time the app goes into the background and the download is suspended.
Is there any way to either:
prevent an iOS app from entering the background whilst I perform my download
or continue peforming the task in the background (i.e. perform the task irrespective of whether the app is in the foreground or background)
Thanks
It really doesn't matter, if the user presses the home button it will go to background. Although you can do two things to mitigate the problem:
Use beginBackgroundTaskWithExpirationHandler, to give you a bit more time to download. Which you can read here.
Don't allow the device to become iddle, with [UIApplication sharedApplication].idleTimerDisabled = YES;. You can read more about that here.
Either way, the best thing you can do is to tell the user, that is an important download and he shouldn't quit the application.
Can't you include some or all of the content in your app bundle instead, and just download changes on first run?
I can't imagine this is a good first user experience, and it may not pass App Store review like this.
The only third party apps that are allowed to download in the background are newsstand apps loading issue content, and Apple are pretty strict about what they allow as newsstand apps.
You can't do what you want, in this situation. One way, and I think the best and only, is to resume your download when you app becomes active (returns to foreground state). Also, don't forget to register for connectivity notifications (Reachability class can be used for this purpose from this Apple sample app http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html). Good Luck!

iOS 5 remote notification when launching app from dashboard

since iOS 5, notifications are no more intrusive as previous. This is nice, but it seems that users prefer to tap directly on app icon from the Dashboard instead of the (small) banner area or notification center.
In such case, my app cannot get payload from notifications.. Even the 'application didReceiveRemoteNotification' method is not able to get the notification.
Has anyone got the same issue? Do you have any advice?
Thanks
The intention of the push payload is just to display something useful/informative to the user in the alert. Not to actually send data to your app.
So you will need your own web service to provide the data your app needs. Your app should refresh/sync to that service when it launches to get the data.
Example: Instagram. It can push notify you that someone commented on your photo. But it's not actually sending the comment data in the push to display in the app. The comment data is downloaded when you launch Instagram and attempt to view the comment.

Disable iphone home button in app, is it possible?

I want to develop a screensaver-like app where the only way of getting back to the springboard is entering a code. Therefore I would need the Home Button action to be ignored, that is that when the user presses the button nothing happens..or something custom...instead of going back to the springboard and terminating the app.
Is this possible? does anybody know if apple will approve/reject this kind of app?
The answer to your question is, yes.
The answer to the question you meant to ask--can I ship an app through the iPhone store that has the home button disabled--is no.
If you are only publishing your app to jailbroken phones you can do it, but it will piss everyone off.
Edit 7 years later:
This is actually extremely possible now--there is a standard feature in the iPhone called "Guided Access". It's hidden under that "Accessibility" Link (With some other fairly cool stuff like flashing the LED whenever you get a call and allowing a Bluetooth keyboard to tab between controls)
It's called "Guided Access". You set a passcode, launch the app then triple-click the home button to start guided access.
It disables exit and allows you to designate regions of the screen you can't touch. You can also set a time limit (For kids playing which seems to be the reason a lot of people look up this question).
Tempted to edit the "Accepted answer" and throw this info in there, but that seems rude so I'll just hope people find this answer.
Annoyingly you also seem to be unable to shut off the phone--I suppose this is perfect for people who want their kids to play a game, but might not hit the original asker's problem of restricting access to a single app (I mean it WILL do that but it'll also prevent it from doing ANYTHING else).
Not with public APIS (and hopefully, not with private ones). Even if you manage it somehow, Apple will reject it for breaking UI guidelines. Moreover, even if they didn't, people could always use the iPhone's "Force Quit" equivalent to hard terminate your app.
Apple is not going to approve this type of app, they state pretty explicitly that you're app needs to respond appropriately to springboard telling the app to terminate both when things like phone calls come in and when memory warnings come in.
This is not possible with the current SDK, nor do I suspect it will ever be.
You might be able to get this behaviour via jailbreaking, but you won't be able to sell your app through iTunes, nor will Apple ever approve such an application.
You can do it like this
Install the following mobileconfig file
This will disable the home button once you launch the app
Download
Found the link Here
Apple won't allow it.
What if something emergency happens and you wan to dial an emergency phone number. You are putting the user at risk. The trade-off isn't worth it.