how to make notifications programmed with OneSignal ?, for example ClashRoyal when a chest is unblocked, do you know how to do them? [on hold] - firebase

how to make notifications programmed with OneSignal ?, for example ClashRoyal when a chest is unblocked, do you know how to do them?

You're thinking of offline notifications, to put it simply, when you open the app, (say you have like 30 mins left on a chest) it'll sync that time with your devices time. So it'll get the time the chest will finish based on your devices time so even when you're offline, it can still send the notification.
Now, to send notifications, you can check out Firebase's cloud messaging: https://firebase.google.com/docs/cloud-messaging/

Related

How to get instant changes in background from private api in mobile app?

I am planning to create a mobile application for android and ios users, i think i will take a try with xamarin since i will be alone on this project and i don't have a lots of time.
I want that the mobile app for both platform get datas from the api, then if there is new datas available we notify the user by a notification.
How the mobile will work in that kind of project? I mean should i make a background service then check every x seconds/minutes by http request? In that case which time interval? Should i use websockets instead for this case?
The app might be used by many people, so i would to know the scenario in this kind of project: Getting very fast changes, without overload the server due to too many connects or whatever else.
I'm confused about this and i need some lights around, any mobile application/server experiences related would be apprecied!
EDIT:
As suggered by an user, here additional infos:
The api is homemade, restful using JWT made in NodeJS.
Each users on their device should get messages from server asap, even when the app is in background/closed.
Maybe in the future a way to send messages between users themselves.
You have to implement push notification.
It is quite easy to implement this in xamarin. just send the push notification to the device and on the notification received call back send the API request to retrieve the updated data.
Here is the document for sending push notification from custom API.
https://docs.microsoft.com/en-us/appcenter/push/pushapi
I'm not a mobile developer, so take this with a grain of salt.
The answer to this really depends on what you're doing, which informs how often to check the API. If it's a messaging app, for example, you could have it check every couple minutes to see if there are undelivered messages, then check more frequently for the next X minutes (to facilitate a conversation in real time).
If it's a GPS navigation app to be used while driving, you'd need much more frequent requests.
As for the API, that also depends on what type of API and the number of requests you can make to it. Is it a commercial API that you get x number of calls per hour on? Is it an API that you built? Etc.
Basically, you need to give more information in order to get more specific answers.

Best way to utilise push notifications when app goes into background

I am a React Native developer currently working on a vehicle tracking app.
We want to develop a feature that allows users to exit the app, but continually be updated in the form of notifications when the vehicle moves (on average every 60 seconds).
I have been tasked with coming up the best way of integrating this. Our app already has push notifications set up with Firebase and we do use this to push out generic messages to the app.
My thinking is as follows:
When a user begins tracking a vehicle, the app should subscribe to a Firebase topic identified as the vehicle's registration. On the server side, each time an update comes in for a vehicle, send out a Firebase notification to that vehicle registration's topic, and then any users tracking it will be updated. When a user returns to the app and presses 'Stop tracking', the app unsubscribes from the topic.
In theory I think this would work. The reason I'm posting is I'm not sure it's the most efficient way. Our server received updates for over 1,000 vehicles every minute.
Any help/ideas would be gratefully received!

Does Ionic 2 support private & public Firebase notifications?

I'm thinking to work on firebase notifications in the last few days but I want to some answers for this few questions:
Does Ionic2 support firebase notifications ?
Will notification show in the top of screen when my application closed or it should be work in the background ?
Is firebase notification sent on time or it may take long time ?
If I assumed Ionic 2 can send private notifications (to my device only), so can I send public notification for all application users ?
If the answer of all questions "yes", wish you give me any useful links that may help me (if you have a time)
Yes it does, and it works fine with FCM (Firebase Cloud Messaging, aka GCM - Google Cloud Messaging). It supports subscribing to topics and device-to-device notification via HTTP client. The topics subscriptions and device-to-device both require FCM plugin.
Yes, they'll appear on top of your device screen as any push notification, you'll just need to code how it'll behave after receiving it, like execute something if the notification is tapped, or do something if it's received and the app is already open (foreground), it's all up to you.
It's sent on time, i've never had delay problems, the longer it took to send the notification and i receive in my device was 10 seconds. But as far as i know it "stores" your notification for 24 hours, so if the servers go down or something happen the notification has a life time of 24 hours to be sent.
You can, as said in first answer, subscribe your users to topics. Let's say you want a topic to sent message so all users can receive, you can have an all topic, or have one only for logged users, one only for users who bought products, you can even get all users tokens and send one by one, but it's much better having them subscribe to topics.
Topics notifications can be sent via the Firebase project console. Device-to-device is sent by your app code.
To send device-to-device you'll need a token, it's provided by the FCM plugin (link above) and you'll need to store this token somewhere, like in your user node on Firebase. I usualy use the user device ID provided by the Device plugin to have his token, since the user can have multiple devices and log in all then, this'll prevent token overriding.
I don't know good tutorials about configuring FCM with Firebase, if i find something i'll edit the question and add it for you, but stick to the ionic native link and the FCM plugin github page.
Hope this helps.
In addition to Gabriel's answer:
The default behavior for notifications is for it to show on the top part of the screen. I haven't worked on Ionic before, but AFAIK, the behavior should compared to Android.
With that said, you should refer to the Handling Messages part of the FCM docs.
There are factors to consider that may affect the time it takes for the device to receive a message, but as FCM's behavior, it would try it's best to send the message, as soon as feasible (see my answer here).
Gonna itemize this further:
Specific device only - Yup. When sending the message, just specify the registration token(s) that should recieve that message.
All devices - Yup. You could use the Firebase Notifications Console. But if you intend to send the message by using the REST API, you have to make sure that the devices are subscribed accordingly to your custom global topic.
About the device-to-device Gabriel mentioned, I think it should be worded as server to specific device(s).

Real time notification among android app using server in between using FCM or XMPP?

I have a requirement on communication between 2 android device. When one device triggers a request to another device to do something, the second device starts working until first device ask it to stop.I tried using FCM with only data as notification is not needed.
I have tried Firebase Cloud Messaging but notifications are not consistent i.e some time comes immediately/with 10 min delay/never comes at all.I was using Android simulator.With rest api call also same thing happens. With XMPP i have not tried (even it comes immediately i can not make more than 1000 connection per senderid).I have tried with both use cases with app in background and foreground.
from FCM notification point of view is this delay expected (as it is notification and not real time)?
I am also thinking of using some other XMPP server to have the connection always and send data in real time to achieve this. But don't wanted to spin and scale up/down ejabber kind of server for this kind some small but critical use case.Any pointer would be great !!

How to get my iPhone app to communicate with my server on schedule or on demand?

So basically we want to build an iPhone/iPad application which could allow user to read our company documents, however when the phone is lost or stolen, we want to be able to delete the documents stored on the phone. To do so, either server would need to send a push notification message to the mobile device, or the mobile device should be able to communicate back with server on a timer basis such as every 1 hour.
I am new to iPhone development. Based on my reading over internet, the followings are what I found, please correct me if I am wrong here:
there is no way to schedule my app to run on a timer basis natively
I could use APNS push notification to send a notification to device, so user would click on the notification and my app would get launched. At that moment I would be able to communicate with my server to get the delete command, and then my app would delete the documents on the phone
I could use local push notification to schedule a notification for my app, so user would click on the notification and my app would get launched. At that moment I would be able to communicate with my server to get the delete command, and then my app would delete the documents on the phone. this would be same as APNS push notification.
However on the above case 2 and case 3, there is user interaction required. So what if my phone got lost or stolen and phone has PIN protection. The guy who has my phone could not unlock the phone. In this case, my app would never be able to communicate with server any more, thus it won't be able to delete the documents.
Am my understanding correct here? Any suggestion for this case? It would be really appreciated for your suggestion and insight. Thanks very much.
when the phone is lost or stolen, we want to be able to delete the documents stored on the phone.
You can wipe the entire phone using the iCloud remote wipe feature. Why not use that?

Resources