I want my app I build with Cordova and which runs on Android and ios to check my server for some data. I then want to use this data to update the badge at the phone homescreen. For this badge I use the plugin created by Katzer https://github.com/katzer/cordova-plugin-badge.
Now I believe the best way to achieve this is to generate an Ajax call to get the data from the server. Problem is that I want to do this specifically when the user is not actually using the app, preferably about once a day. Now I have found that it is possible to achieve this in the background using various plugins that create a background mode, but this is battery intensive and won't work if the user as stopped the app.
My question is what would be the best way to update my badge without the user having to open the app?
As you said, you need to use a background service OR if you use FCM (Firebase Messaging plugin), you can set the badge number while you are sending a notification.
So the best way would be to push to the device when something happens and change the badge number at that time. Then there is no need to do any Ajax call as you can use the data that was sent with the notification.
Also welcome to S.O.
Related
Can I use Onesignal to send a notification of order changes to an Android device then if the user already opened the application on order's page/view the notification will be not shown but the order status on that page will be changed?
If yes, can I know the reference of documentation/tutor? If no, what are alternative ways to do it?
I have a project using Onesignal to send the notifications to the android devices. Currently just Simple notif, but my boss asked me to make the mobile app can auto change status order without user action. I'm a backend engineer, not an android dev so I don't know what really works of Onesignal in android. I just know Onesignal can be used to send the notification but what about data process after notification sent?
This is what I understood: Your app has some kind of market or something from which people can order stuff. So, you want to know if OneSignal can send automated notifications as the order status changes?
If I have got it correct, my best guess will be, no. OneSignal can only manually send out notifications. The closest one can get with OneSignal to automations is scheduling notifications to be sent later. To achieve your purpose, your Android devs will probabaly have to write some code on their own and integrate it some way with the order status and all. Or else, your boss will have to appoint a few people who can track the order of the people and manually send out notifications to them using OneSignal (but, identifying the correct device might not be so easy).
That's my guess. But, OneSignal's support team is pretty nice. They might take a few days to answer, but, it's worth asking them if they can help your developers integrate the order status and OneSignal's notifications in some way.
I'm using Xamarin Forms and I manage to send notifications to my applications in both iOS and Android using Firebase. I want to change the Badge icon every time a notification arrives, with the application in the background.
Similar to Twitter or Whatsapp.
How can I change the Badge of my application when my application is in the background?
I used MessagingCenter in Xamarin before. It is a publisher and subscriber event that you can use.
For Android I use ShortcutBadger https://github.com/leolin310148/ShortcutBadger
But it's up to the Phone's Launcher to decide if it will show the badge and for me it wont show on the Emulator but it does work on my phone.
As for iOS I haven't looked into this yet so if you find one please do tell.
If I store a specific time (a stringified Date object in localStorage perhaps, or some equivalent local persistent storage facility on the native device… I'm new to this so I'm not sure what is best yet, and any suggestions would be appreciated!), how can I trigger an alert (vibration, noise, push notification) to iOS or Android at that specific time?
I'm trying to make an alarm-clock type application that notifies the user each specific time stored in a local storage facility. Maybe there is even a way to simply say, “Push a notification at 11:00 am” or something like that. I'm working with Appgyver which uses PhoneGap and Cordova technologies, and I'm trying to build an app using Angular.js for iOS and Android. Thank you in advance!
you must use android services for keep codes running even when your app is closed.
i think this answer is for you:
creating-an-android-service-with-phonegap-have-phonegap-app-run-even-when-close
You could schedule a push notification from your backend. In-app push notifications are not yet supported on AppGyver, but push notifications from the network can be used with https://github.com/AppGyver/PushNotifications
I have an Event management solution with web and mobile app (for both android and ios).
I am using Phonegap 2.7 for mobile app.
In my mobile app, I'm just displaying the data that is created and updated using web solution. I have a list of "Tasks" and "On-Site Tasks" in the mobile app with Date and Time and have scheduled local notifications for all the items using Phonegap's local notification plugin. The notifications are working as expected and I am recieving them on time.
But when the data is updated using web solution I have to reschedule the local notification on device and for this I have to launch the app every time I want to update the previously scheduled notifications.
My question is, Is there a way to update the local notifications whenever the data is updated on web solution without launching the app ??
I want the local notifications to be updated automatically when the data is updated from web solution.
iOS dev here, I don't know Phonegap nor do I know Android. But in general for iOS:
You need to use push notifications instead. The purpose of local notifications is to maintain them completely client-side. If the notification depends on server-side state, and you do not want to launch the app to update notifications, you need to dispatch the notifications using push.
https://en.wikipedia.org/wiki/Apple_Push_Notification_Service
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9
I want to know the complete working mechanism of the mail apps for android.
Actually I build an android app for big data product.It has a feature which will shows the notifications (list view) .
Now I want If new notifications come in the DB It should ring a bell and in notification bar of the android phone it should show, As in case of Mail apps, as soon as we got new mail a notification comes in notification bar.
NOTE: android server which needs to be queried may not contain internet.This App works on intranet also.within a company network.(without the internet)
So I want to know the mechanism to implement this feature.
1) Whether i should run a background service which will send query to server on regular time interval.
2) Or any other services like push notification.
I just need a clear idea about working of these type of system.So that I can implement this in effective manner.
Thanks
Obviously the best solutions would be to use PushNotifications. This is how GMail does it, and this is how every email app, or messaging app has to do it.
Polling the server will drain the battery, and will also make extra (unnecessary) data traffic, which is something you don't want your app to do .
You should get started here : Google Cloud Messaging. In my opinion it is very easy to setup, and I recommend using GCM, instead of all the other alternatives like Parse and so on.