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!
Related
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.
I found some weird behavior in push notification. My iPod app receives push notifications till last week with no issues. Then I found that my app is not receiving push notifications, and I changed the certificates and it worked fine, and after 2 days its not working. And I repeated the same process and same kinda problem. I was wondering why this happens?
NOTE I am using my own java based server to send push notification. I am sure that my certification are not expired. At the time of this problem the badge id is also not visible with my application icon.??
Thanks in advance.
Ensure a few things
You are using the correct combination of production or dev pem and the APNS or sandbox server URL
Check the Feedback services to ensure whether you are getting any errors
I faced similar issues with my 3GS running OS 4.1 last week. It started working after I restarted my device. Try doing that and see if it works.
Please make sure to update the device token in the database of you provider. I guess some updates in your iOS/certificates may changed your device token. Just make a test around that.
Try lostInTransit's solution and also check for your internet connectivity. I also faced this issue with my iPod sometimes the push notifications not come in my iPod. Try this -
Install facebook iPhone app on your device.
Send a test push notification from your server.
If the notification does not come then do something with facebook which should generate the notification.
If the notification from facebook does not come it means its related to your net connectivity.And your code is perfect.
Sometimes I see that when my iPod is on DHCP it does not receive the notification but when I assign it a static network (dedicated IP) it works fine.
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.
Look at this app for example.
How does this work behind the scenes?
I know you can set the badge by using:
[UIApplication sharedApplication].applicationIconBadgeNumber = somenumber;
However, this would need to work in the background for it to be able to stay updated. However, there's a 10-minute restriction for backgrounded apps. I'm thinking it has something to do with push notifications, but I don't know how that would work exactly.
Any ideas?
I'm setting a bounty on this. If possible, I would like a detailed step-by-step process of how to set up my webserver to handle these push notifications.
APNS (Apple Push Notification Services) has an option of showing a notification with just a badge (no alert, no sound). You can specify it in the payload. That is how the badge can be updated.
You can have a server send out the message to the user or use local notifications. But since you want to get the user's weather information, I guess a message from the server would be the way to go.
You can also specify that the app uses background services to get updated location and use this location to get the weather info.
Here are a few good references. Once you get the hang of it, its actually pretty easy rolling out your own server/client
http://blog.boxedice.com/2009/07/10/how-to-build-an-apple-push-notification-provider-server-tutorial/
http://code.google.com/p/apns-php/
http://www.easyapns.com/
The 73 here, is normally how you'd see the amount of messages related to the app there are waiting for you.
I assume you can set & reset that number, so they just push an update to you, saying you have 73 in-app messages waiting for you, and they abuse that mechanism to display the tempreature in farenheit.
You're correct, they're doing it through APNS (Apple PUSH Notification Service). It's pretty complicated to set up, but google "iphone APNS" and you'll find much better guides than what I could whip up off the top of my head. Here's the one I used to get out service working. It does a good job of walking through the process step by step.
Once you get it set up, you'll want to pass along a "badge" count with your APNS notification. The documentation for how to do that is here.
I'm going to do a simple app similar to Apple WiTap example. The purpose of it is sending a small text message between two devices.
The user with the first device writes and push over 'Invia (send)' button. Once done, the message will appear on second device with an alert.
How could I implement the string sending-and-receiving part in my project?
The wip source is located here: http://bit.ly/fYAQsb
Thank you.
You can use PubNub to send and receive messages, completely bypassing APNS.
Quick start and tutorials can be found here: http://www.pubnub.com/docs/objective-c/iOS/ios-sdk.html