What is the fastest and the best way to push notifications to client? - react-native

I am making app that need to supply user the latest updates as soon as possible.
My current experience is that WebPush notifications show up too late or latency varies too much from device to device (aggressive battery saving policies etc.), plus they are not supported by Apple products and I can not use WebSockets since users will probably go away and chrome will go into sleep mode, which WebPush and ServiceWorkers should solve but, as I mentioned, they have a problem.
I'm thinking that using 3rd party software or making native app (via React Native) may solve some of these issues but I'm not sure.
What do you guys think about above-mentioned possible solutions or do you guys have any solutions or suggestions?
I've tried using WebPush (latency issues) and WebSockets (user automatically disconnecting after some time)

Related

Use Firebase cloud messaging or let the app asks for event and fire notification with an API?

We are developing an app for Android and IOS for students. student can receive notification for upcoming events like exams or interviews.
We are between two decisions: Using FCM with the development of a backed which manages the sending of notifications and the registration of tokens or using the schedulers that exist in IOS and Android then download a list of events from an API regularly and trigger a local notification which will require less development on the backend side but a little more on the frontend side.
What would be best in your opinion and can we trigger a notification even if the app is closed for the 2nd solution?
I would deffinitely recommend to use FCM. It is much easier than it looks like and the performance of your notifications would be much better regarding stability, timing, battery persistance and other. You can use on of the Firebase databases to store the notification tokens and the Firebase Cloud Functions to send them from there. I have made a very similar App for Kindergarden children and it works great. I'm not sure if it would even work at all when you do it on your own. At least not as you expect it. For me that sounds like much more work.

How to create background location service in Appcelerator Titanium working after restarting device

I want to make an application which will send information to a server about user's location every 30min. It is needed to provide location specific push notifications.
I need such functionality for Android/iOS, which would work in background (also if device is restarted). I found some articles covering background services and I created background service doing that, but after phone is restarted it won't work.
Is it possible with Android and iOS? How can I achieve that?
With iOS, no. With Android, yes.
Apple has gone to great lengths to limit what apps can do. You can do some things in the background for an extended period of time (GPS, play audio, Voip, etc), but after a reboot your app will not be restarted until the user opens it again. There are exceptions to this. Voip apps are allowed to restart after a reboot, but apple will not approve your app for the App Store unless you actually have a place for a user in your app to use the Voip feature. Geofences are a possibility, but I haven't had experience with that feature yet. In my experience, Apple does whatever they can to make sure your app doesn't run forever.
With android, there is more flexibility and what you propose is totally possible. I've listed some important links below, since most of those solutions are far better documented than what I can do here.
Essentially you need to register as a boot receiver and then send an intent to start a titanium android service when the boot event is received. I don't have experience with starting a titanium service, but I'm sure its a simple intent you need to fire. Either way you'll need a module for this native code. I attached a link to a bencoding titanium module that may help you, although there may be some others out there. You may even need to code one yourself.
Samsung is notorious for stopping your app with their SPCM feature. You may want to familiarize yourself with it. I've added a stackoverflow discussion link below.
I don't know all of your system requirements but honestly, for any app I would try my best to not run forever. It will hurt the battery life for your users and will add a lot of complexity. Maybe you could simply have the app check the GPS coordinates when it receives a push notification and decide right there and then whether to present a notification to the user? Just something to consider.
Either way good luck!
How to start an Application on startup?
http://docs.appcelerator.com/platform/latest/#!/guide/Android_Services
https://github.com/benbahrenburg/benCoding.Android.Tools
Dealing with Samsung SPCM killer

Objective-C Async communication between IOS devices

Is there a way to perform async communication between iPhones/IOS devices? I have been researching and thought maybe APN might fill that void, but it sounds like I can't initiate an APN push from an IOS dvice to another, and even if I could I can't trigger the "event" on the other device with just an APN push from what I can identify.
Does anyone have any examples or general advice for IOS device interaction for devices that are not in GameKit (i.e. wifi/bluetooth) range that does not require an intermediate service (urban airship, dedicated server, etc) or will I need to have a 3rd party in order to trigger and/or sync these interactions between devices?
Sorry I don't have any code or details as this is still in the planning phases for me. Any pointers would be greatly appreciated.
The answer is : use a server side app and have all your devices talk to that server.
If you dont want or cannot host an app, you can use a cloud solution based on websocket like Pusher. You can then subscribe to events and post messages with data.
They have an iOS client library
http://pusher.com/docs/client_libraries
P.S: Also have a look at Parse and Stackmob , i remember that had this kind of feature was in their roadmap, but i don't know if it's available yet..
Hope this helps,
Vincent

Perform a task every day even if running only in background

I need my application to perform a background task every day, but it does not comply with Apple's specification for running in background.
It's none of these: audio, location, VOIP, news stand, external-accessory—, Bluetooth-central.
I'm planning to use local notifications, but the point is, that if the user doesn't open the app (and just leaves it in the background), I cannot plan new local notifications.
What should I do in this situation?
Make something else.
Seriously, if your app doesn’t at least technically fit one of those categories, you’re not going to be able to get it to do background work in a way that’ll get you approved for the App Store.
I’ve seen apps that added specific functionality in one of those categories, orthogonal to their actual purpose, to be allowed to run in the background; for instance, there’s a couple of weather apps out there that play a continuous audio file—one of the available sounds being a silent one—in order to be able to update the lock screen’s “now playing” image with live data. If you don’t mind your users being unable to listen to any other music, and have your app continuously active (which might cause additional battery drain), that could work. But if you’re trying to have your app invisibly do things in the background, without interfering with anything else, in a way that’ll get you into the App Store, you’re probably out of luck.
Four options:
Go for jailbreak
Try to get in the app store as one of those types of apps, making up a feature that uses one of those types.
(my favorite) Really rethink your system, is it really necessary to schedule background tasks? Can't the user wait a bit when he opens the app? That loading can be performed in background. And can't you offload some of the work to a webserver? Are you collecting data? You shoudln't without the user consent.
Let your user know that it's important for him (he's the one using it right?) that he opens the app once a day.
I think I covered all yohr options except the one already covered by Noah.

Robust real-time communication between iOS App and Mac App

We're working on an exhibit (http://pulse.media.mit.edu) and I'm brand new to iOS, objective-c and Xcode. The exhibit deadline is in one week and I'm stuck.
The problem I'm having seemed simple enough.
Our exhibit has a projector and an iPad. The projector will be hooked up to a mac and be playing a video. The iPad will act as a controller for those videos. More simply:
I have 50 videos on a Mac. I need to develop an application on the Mac, that, when opened will loop one of the videos.
On an iPad, I need to develop an app that can change between the videos on the mac in real time. The iOS app is already designed, we're just struggling with some code.
On the mac, when the iPad tells the Mac to change video, we'd like it to switch between videos using Core Animation, like this (http://youtu.be/pyd8O-2mkgk?t=1m).
So my question: What is the most robust way to do this? It has to be able to run in a museum, for two months. Some things to consider:
We are 4,000 miles away and can't monitor it all the time. We'll
check nightly to see if it's still working, but it should run the day
without breaking.
If people unplug the iPad, it should still work.
It should be as robust as possible.
How can I best do this? Should I write to a database from the iPad onto a database running locally on the connected Mac and then monitor that database 10 times every second? Are sockets robust enough to use alone?
If you do suggest a way, can you please point me in the direction of some resources (frameworks, function names, etc) that can help me do this quickly?
Thank you for your time.
I would go for the server-in-the-middle option, because it will be easiest to debug, and requires nothing more than a working internet (wifi) connection on the client side. When having connection issues, all you need is someone who knows how to hook up an iPad or Mac to the internet. And you can see server-side which device has issues connecting.
Furthermore, using plain HTTP sounds like the best way to go for communication, and the backend can be written in any server side scripting language. Both clients should be polling the server every X seconds.
If you get this basic setup working well before your deadline, you could try to get the devices to connect to eachother directly (for a less sluggish user experience), and leave the server solution in there as a fallback method. The Mac app could function as a HTTP server, accepting the very same commands that the iPad normally sends to your server. The challenge will be to reliably know which IP to connect to. You could hardcode it or use Bonjour.