Regularly polling multiple API for a push notification iOS App - php

I apologize in advance if this question is too subjective.
I am working on an iOS app that allows users to search through multiple API's to find a result, and then get a push notification when results similar to the ones the user signed up for are found in those APIs.
I am comfortable with the iOS part of the app, but what I am curious about is how should I handle polling multiple API's regularly to see if any of the signed up for topics have received a new item.
The first thing that I imagine is that if a user signs up, for example, to receive notifications when a new X is available, I would have a web server that would go through each of the signed up topics for each user every X minutes, if there is a new result then send a push notification to the user. Even though I have little experience doing such a thing, I know that this will probably be very taxing on the server, and will only get worse as the user base expands.
So rather than periodically querying the API's in the background, how could I go about doing this? As far as I know, the API's I would be use do not allow for push notifications to my server from the API.
Thanks in advance,
Will

Related

Android GCM Push notifications to multiple users from a database

I am trying to incorporate GCM push notifs to my app. I was reading a tutorial but unfortunately it uses REST api and slim framework and I don't have an idea on those and it will be time consuming for me to study about those. What I am thinking right now is to just SIMPLY assign each user in the database with a gcm registration id and send them a notification. But the problem is I don't know how to get gcm registration id in the simplest way. I have less knowledge when it comes to PHP or server side. Can someone help me or just give me a link tutorial using simple implementations? I would really appreciate it.
By the way, the purpose of my push notif goes like this: On a specific period of time, let's say on a specific date, there will be a list of app users that are qualified for a contest. Those users should receive a notification on their phone once they are connected to the internet.

Twitch API Live Callback Service

I am integrating the Twitch user account API into my platform and had a look through the API to see if there was a callback section of some sort to send an update to my server when a user starts streaming, but I can't seem to find any reference for one.
Is there currently any services that offer this sort of thing? If not, what would be the best way of running regular checks on all of my users in my Database to see when they are streaming, of course doing this alone would kill the server with database queries, so I'm stuck as to where to go now.
What I am looking to do is receive a callback and then create a post in a social feed that the user has started streaming.
Based on the discussions at the links below, the API doesn't support webhooks and won't anytime soon. Instead, they expect you to use polling. Basically you would set up a worker process that makes requests periodically, such as every five minutes, then creates appropriate social feed posts, etc. You can batch them together if you have a bunch of channels to check (exaple from from the github issue):
https://api.twitch.tv/kraken/streams?channel=riotgames,dota2ti,machinima,esltv_hearthstone
https://github.com/justintv/Twitch-API/issues/211
https://discuss.dev.twitch.tv/t/notifications-using-twitch-api-and-php/1009

Implement real time features into a symfony2 application? (live dashboard)

I have a symfony2 app what stores data in MySql. It's a simple app, I mainly use just php.
In the app there are some administrators and they got a dashboard where they see every activity in the app. You have to refresh the page to see the new activities.
Now I have to make the dashboard real time.
There are some event specific notifications, for example you push a red button on your panel, and in 3 days you have to push it again. If 3 days past and you didn't push it, the administrator who is watching the dashboard now instantly get a notification. The other admins see it too after they watch the dashboard.
And there is the "real real-time" things, you push a blue button on the website and every administrator instantly get a notification on their dashboard, no time delay.
I never worked with real time apps before, so I read a bit in the topic.
I read about pubnub (and its brothers),socket.io and node.js but I'm not sure abou the most efficent model.
Pubnub have SDKs for PHP and socket.io, so I think I can do the real time part, but have no idea how to start the time specific notifications.
On the other hand, maybe I should go with the node.js, and do a long pooling solution, so I constantly read my MySql server with node and push notifications to Socket.io ,but I'm not sure countinously read my database is a good idea.
I know php is not really the language for deamons, I know nothing how it's going with node.
I'm not really asking for code, but for logic, how could I implement this in a smart and efficent way?

Send Push notification to specific Users

I am trying to develop an android app that verifies a transaction initiated from a browser on a PC. I want the server application to push a notification of a new transaction to the app so the user can confirm to complete the transaction. The tricky bit is the transaction is specific to a particular person (I'm using this as an alternative to sending an SMS for example). Can anyone help on how to go about this? Is it possible to do this with C2DM or GCM?
Using Android GCM is advisable. The complete reference to GCM is available at
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
Step by step GCM development is given in there. It is really very helpful. Hope this is helpful to you.
The critical thing you need to keep in mind before making a decision is that when you are using GCM, you need to keep a track of the users by keeping their GCM_ID in your database. You can add a gcm_id column to your users table for this and whenever the user opens your app, the gcm_id should be updated in your database. The gcm_id of the user's phone can change, from the official docs:
Note that Google may periodically refresh the registration ID, so you should design your Android application with the understanding that the com.google.android.c2dm.intent.REGISTRATION intent may be called multiple times
GCM push notifications wont be able to reach your users mobile phone all the time,especially if his phone is not connected to internet or switched off.You are using this for transactions etc, so I assume that the notifications must not fail. You should keep a check in your web application to send an SMS or notify the user that this has failed. You should get a response from GCM to your server through which you can identify a failed case.

AS3/Air iOS and Android data sync data to/from multiple devices to remote DB

I am about to undertake the development of an app that requires sycning of data from the local device to an online DB...and back.
I am building something that will allow users to create events and invite users to those events. Users will also be able to chat and receive in app notifications. I would like to store the information in local storage that the user creates and push this information to an online DB when there is internet available. Then if there are any waiting events or notifications for that user, they can retrieve them when online also.
My concern is about the merging of data and the fact the local storage PK's will not be the same as the online PK's.
For example, user1 and user2 both just installed the app. They both create an event and invite each other to the event. Once they are both online their devices try to push the data to the online DB however there is a conflict with the PK used.
My question is: Can someone give me some guidance about how best to handle a situation like this? The app will be built using AS3 and Air and only for iOS and Android. There will be a MySQL remote DB with a PHP backend.
Any help is appreciated.
You could also send a time stamp of when it was sent to use with your PHP, where the request that got there last has an event sent back to notify the user (probably best with a push notification) that there has already been an event made.
Also not sure if you know already, but you can use NetConnection status to get a sense of when they connect to the internet.
localNc = new NetConnection();
localNc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
function netStatus(event:NetStatusEvent):void{
trace(event.info.code);
}

Categories