Manage badges for push notification in iOS app (Phonegap) - ios

I am building a phonegap based app and trying to update and manage the push notification badge in it. At this point of time, what I have checked all over SO the solution seems to be in either passing the value in 'aps' payload in our server code or in one of the methods that we have in AppDelegate.(I have done this both and found it to be working)
However, what I want to know is to how to keep a real time update of the number of notifications received/read by the user so as to update the app icon automatically?
I believe it is related to our server code, but I would really appreciate a detailed example/explanation on how to get this done as I have been struggling to get this work for a full week now.
P.S: I have checked almost all the links related to badge in iOS in Stack Overflow but have not found something with enough code or example to get this working successfully.
Thanks.

Related

Google API Changes causing problems on my App

I have an iOS App on the App Store, and it connects to Google Drive. In the past week or so, I've noticed two new problems in my live app.
The App suddenly stopped logging in. I would get a 401 - invalid_client. I found a lot of questions/answers for this problem, but they were all for people who couldn't get it working. Mine was working for about two years and then stopped working a couple of days ago. After trying a lot of things, I found that I was using <id>#developer.gserviceaccount.com as my Client ID, and when I changed it to <id>.apps.googleusercontent.com it worked again. I don't know why this change fixed it, and even knowing that this fixes it, I can't find if this is the correct/appropriate solution.
I explain my second problem, which is very specific here, but skip to the next paragraph to get to the point. The second issue is a a result of Google changing the way their API calls respond, and this is why this wasn't an issue when we submitted the latest version of the App to the App Store. Google has changed the way the explicitlyTrashed property of their GTLDriveFile class. Per their spec, this property should be either an NSNumber containing Yes, or null. They have recently changed it so that it is always an NSNumber set to either Yes or No. This is what's breaking our functionality.
Anyway, these are two changes Google has made on their end recently that currently has my customers on hold since I have to fix this and push it out. My question is if there's a place to keep up with these changes that Google is making recently. Also, if someone knows or can point me to why the first issue is happening, I would greatly appreciate it.
For the first issue, the reason why it got resolved by using [id].apps.googleusercontext.com is because it it requesting an authorization token from an app to the server, as opposed to a Server to Server transaction using impersonation ([id]#developer.gserviceaccount.com). This is the right solution for both android and IOS apps requesting a token.
As for your second question, the best way to keep up to date with the latest changes is through their official blog: http://googleappsdeveloper.blogspot.com/
Another resource is the G+ Google Drive Developer community: https://plus.google.com/communities/107264319205603895037

How do I make a live text feed for announcements in my app? [duplicate]

This question already has an answer here:
How to send in-app announcements to people using my iOS app?
(1 answer)
Closed 7 years ago.
I would like to add a text feed to my iOS app. Basically, it would just be an updatable UITextView or UIScrollView that would display announcements/news (not an actual news or RSS feed though) on the home page. I want to be able to update this field remotely from my computer to give it a set number of messages/announcements to display one after another in a loop. I don't want to have to update the app to manually add them in via Xcode. I only know Objective-C.
How would I do this? I can't seem to find any tutorials for it. Maybe I'm just not searching in the right way. Can someone refer me to a guide or tutorial or even just a GitHub project I could implement? Thanks.
Edit: I see that a similar question has been asked after all, but I still don't understand the answer given. I'm still new to coding apps so I don't know how to use "initWithContentsFromURL." The person clearly knew what they were doing and so they did not get further explanation. Are there any good guides on how to implement this? I understand you would need to set up a website to store the data, but I'm not quite sure how you would do that. An example of the whole process of setting up the website to store this data and then retrieve it with the function would be helpful.
Look at push notification APN, there is a good tutorial for how to implement push notification
If the messages will only be displayed while the user is inside the app, there is no need for push notifications (which will also allow you to contact the user when the app is closed). The app can simply check with a remote server for the most updated content that needs to be displayed whenever the user launches the app (or whenever he/she enters the screen, or once a day - depending on how often you plan to update that info).

Push Notification Testing Workflow [iOS]

I have hit a dilemma and don't know how to go about this problem.
I have an application right now being tested by a good amount of people. Within this app, I have push notifications set up. No problem with them at all. Everything is going great.
I hit a problem when I want to test versions that are in build currently. If I send a push notification to test certain features, they get sent to everyone currently with the app. Yes, it makes sense. But how do I go about setting up a workflow where I am able to have separate push notifications for live versions of the app and pre-release versions?
I use Parse for the push notifications.
Use advanced targeting. Just enumerate device tokens you need to send push notifications to in where clause. Check out this sample in parse.com forum.

Best way to show the recent post - Objective C

I have an iOS app which is installed in two different device but logged in with same account. If I do a new post from a device it should be shown instantly in the other devices. Currently I am refreshing the posts feed for every 10 seconds interval. Is this is a optimal way or is there any other better solution for this.
As #wattson12 was saying push notification are designed for that.
I would recommend using an API for that : Urban Air Ship
What you do is called polling. It’s the simplest solution, but it’s not optimal, because it requires you to query the server constantly and still there’s delay before you know about the new posts.
One way to know about new posts is to keep an HTTP connection open, waiting for the server to notify you about new posts (see Wikipedia for details, also related question here). Other option is push notifications: the server can post a notification when new content arrives. I’m not sure which one is technically more simple.

In Newsstand app how do I find a list of devices that are subscribed?

I can't afford UrbanAirship so I'm trying to program the server side of a Newsstand app myself.
I plan on using the JavaPNS API.
The one thing I can't seem to figure out is how to find a list of users who have a subscription in my app.
Can I query this information from Apple some how?
If I can't then I guess that means that each time a user subscribes they send their device token directly to my server. I hope this is not the case because I was hopping to run the server on my laptop and send out pushes myself without having to keep the laptop running all day listening for new subscribers.
Thanks!
Looks like I do need to register each device with my server: http://www.ibm.com/developerworks/web/library/mo-ios-push/index.html#resources
You kind of found your answer but just in case you really need a server for not only handling the push notification (for telling your app in Newsstand to check the new issue and download it in the background) but also for subscription and in-app purchasing.
Every time you launch the app you should check few things before you refresh the UI. You should check if the user is a subscriber or has user already bought the issue so you can show view/download button instead of Buy button.
Check out these tutorials if they help to understand these communications better but believe me you will end up with one of those services like Urban Airship (Which I think UA is the best option because it handles all in one not just push notification):
http://ios-blog.co.uk/tutorials/how-to-make-a-magazine-app-in-ios-part-i/
this one is more focus on server part:
http://ios-blog.co.uk/tutorials/how-to-make-a-magazine-app-in-ios-part-ii/
http://www.viggiosoft.com/blog/blog/2011/10/17/ios-newsstand-tutorial
http://www.raywenderlich.com/2797/introduction-to-in-app-purchases
And as always this is the best place for start (it has everything you need):
https://developer.apple.com/devcenter/ios/newsstand/
These are some resources to help you in developing app for Newsstand but still there are not enough people out there to share their experience.
Best of luck.
Edit: Add these two links two this list:
http://www.marco.org/2012/10/11/the-magazine
http://www.marco.org/2012/12/12/the-magazine-future-of-publishing

Resources