Is it possible to send notifications from a Spark Core to an iOS/Android app?

I understand that you can use an intermediate service like IFTTT to send notifications to their iOS/Android app. But if you create your own mobile app, is there any Spark API that will help a Core/Photon send notifications to this app?

Thanks

EDIT:

If I use Spark.publish() would I be on the right track?

2 Likes

Yea, it’s a bit difficult right now, unless you are ok with embedding your access_token into your app. If this is for personal use only then it’s simple but if you plan on distributing it then you’ll need to come up with your own solution. There are a few in the pipeline and I personally have a idea or two to “solve” this but, for now, you have to roll your own solution.

1 Like

But if your app is communicating with the Core, you need to store the access token in any case, correct?

1 Like

Not necessarily. Somewhere you do but not necessarily on the app. You could instead store it in a server in a program or script which your app calls. That would safely obscure it. Ill add it to my upcoming tutorial series as a topic to cover.

1 Like

I have been using IFTTT and found there has been about a 10 second or so delay between the trigger and when the notification is received. You will also find that when triggering a Spark.publish to only have it done once (otherwise you will get a flood of notifications), if you take a look the thread I started you will see what I mean.

If you are going to write your own app and have your own web service to forward notifications, then yes you can do this. The time it takes for the mobile device to get the notification depends on the service and for IFTTT, it does not seem to be real-time.

Look at growl for iOS for instance–that seems to be exactly what you want.

1 Like

Here is a solution using Spark.publish() and Server Sent Events (SSE). My code uses Python, but a similar scheme can be used within a mobile app.