local notification automatic update - android

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

Related

can i use firebase to send notification even f i am offline

I am new to flutter and i am trying to make a todo task app that will remind me of my tasks in there time but what if my user doesnt have internet..
so my app should remind him even if he is not connected.
i saw alot of things about local notification package for flutter..
but it doesn't work on all Android Devices for some reasons (READE.ME of the package)...
so my question is there anyway to push notification without internet (it would be better to push it without firebasee if its not possible).
thanks for everyone
Firebase sends remote notifications and you plug it into the native device notifications API.
So you can of course use another library to pop local notifications. I suggest this one: https://pub.dev/packages/flutter_local_notifications
A cross platform plugin for displaying and scheduling local notifications for Flutter applications with the ability to customise for each platform.
It's a widely used library with a ton of users and documentation available.

Push Notification from local server

I am building my first Android app and need to know how I could use push notification.
My project is a home alarm system and also I have built my own local web server. Now I want to push a notification from my server to my Android app when an alarm appears in my server.
Currently my garage doors use the MyQ app and when the garage door opens or closes I get a notification on my phone, I want to implement the same thing in my app.
I've been reading about the Google Firebase Cloud Messaging but it seems exceeding my need.
If you need push notification on your cell phone then you definitely need to integrate your app with Google Firebase. (or at least that's the right way of doing it).
Alternatively, there is something called as local notifications & background process in Android you could do long polling to check if the garage door is open (probably every 2 mins or something). However, I don't recommend that as it can drain your mobile battery.
Also I recommend using Flutter as oppose to using Native Android. As there are some pre-built libraries for android and Google Firebase integration.
Take a look at this Youtube video - https://www.youtube.com/watch?v=2TSm2YGBT1s
Ouh, maybe thats a little bit too much for starting with android - nevertheless I want to help you.
You need a communication protocol between your server and your phone (i.e. Firebase as you mentioned or Websockets).
If your server sends a message to you client (your phone) you have to create a notification. (Android Developer Guide). That's the theoretical part. You will also stumble across a lot of
challenges with
asynchronous programming.
Firebase might actually be the simplest option. You could build your own web socket service too, but that would probably be more than you need. See this previous question for more options: Android push notification without firebase
Android has some services that communicate with firebase to receive notifications.
You'll need to implement a service on top of your web server (using backend languages such as Python, Node.js, PHP,...) so it can send notifications when an event happened (like the door closed) witch isn't a simple way for a beginner.
then your web server sends a message to firebase and tells it to send a notification to my client.
so I highly recommend using firebase because of the simplicity of usage. otherwise, you should implement a separate service on your android phone to get the notification (if you want to run it locally) also as explained do the backend side.

How to sync data between web and native app without using AsyncTask/timer that makes API call? And then send a push notification to the device?

I'm trying to syncronize message chats between a web version of an app and the native Android app. When I send/receive a message on the web version, it should automatically sync on the native version and show up on my list of messages. How can I do that without having an AsyncTask that runs in the background and calls the API every 5 seconds?
And whats the best method for making that push notification to the phone too, Google Cloud Platform? Ideally one that is free.

Notifications handling in apache cordova app

I'm building an apache cordova messaging app (using javascript).
I'm looking for a way to have more control over notifications in my app.
Is there a way to receive a notification and build its text on the client device? I would like to create it in the user's proffered language and use the user's contacts names in the notification itself.
Also, I would like to be able to decide if to show a certain notification when it is received in the device (for example, don't show a notification for a group chat that was silenced)
Is it possible to do when the app is not open at all?
How is it handled differently from native android and iOS apps?
We are talking about push notifications right?
I don't remember the exact function names but think it's quite possible using cordova notification plugin.
So when app is in active/background, you will be able to get the notification object in your callback and decide whatever you do - show it in notification area using local notification, or show in-app alert or just ignore.
When app is closed, system handles the notification and shows in notification area(based on the notification payload APNS/GCMS sends) and when user taps on it, app is launched and a notification handler callback is called inside app.
Anyway, I think what you want to do is quite possible with native apps and cordova plugin since it exposes all of native functionalities.

How to set a notification off at a specific time even if app is closed

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

Categories

Resources