Firebase: set reminders automatically from firebase [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am developing an android app using firebase. I want to create an event that will automatically remind the user base on user deadline date input choice. For example: user input date from:? to:? and date will be stored into firebase database and user will be receiving reminders until the deadline end. Is there anyway to set an automatic notification from the firebase server? Can anyone point me to the right direction. thanks

If you mean automatic push notification from server, sure it can be done easily with cloud functions and cron jobs. There are many ways to do it
Method 1 :
First, create cloud function with http event to check which event will need to be remindered. And do push notification using FCM token of the user.
Second, make a cron job that call that function daily, or hourly. See detail example here for more explanations.
Method 2 :
Same with above, but using pub-sub event. And the cron job using google app engine. The step by step guide, can be found here

Related

Is there a way to send notifications from firebase when a database value equals a certain value? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I was wondering if there is a way to send a notification to a specific user when a value in their account's database node has a child with a certain value?
Eg:
User-1009ag5443C6a5
Friends: 12
I would like it so that if friends is <= 10, the user gets a notification alerting them of a milestone of 10 or more friends.
You can setup Firebase Cloud Messaging in your app using your existing firebase account, the official guide is here. Each installation of app gets a unique token, as you will find in the guide. This token will need to be sent to server and stored in db, to send messages to that particular user-app instance.
You can then display a Notification when a message is received in your app.

how can I create a turn based app with firebase in android without having a login functionality? Closed [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to make a TicTacToe game with the help of firebase in Android.
And I don't want to Register/Sign-up any user.
I want user to see the list of Online player and then Invite them from that screen and move to gaming Screen.
how can I achieve this functionality?
[closed]
To be able to identify a user, it's easiest to sign them in with Firebase Authentication. But if you don't want the user to enter any registration details, you can sign them in with Firebase's anonymous authentication with a single call:
FirebaseAuth.getInstance().signInAnonymously();
From that point on, the user is signed in, and has a UID, which you can use identify them and their moves, secure access to their data, and more.
Firebase allows this to have security rules in place and still user can access the firebase db as anonymous User. You can read more from this link:
https://firebase.google.com/docs/auth/android/anonymous-auth

Is it not possible to have a code in the background who will be called every 24h? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
In my application I do a ranking of the points of a user. However, I do the calculation of my ranking just every 24 hours. My problem is that I do not know where I should put the code of the calculation without disturbing the user.
Is it not possible to have a code in the "background" who will be called every 24h? Because at the moment, the code for the calculation is called when the first user uses my app after 24h, but then the user has to wait some minutes until the calculation is over. My data of every user is saved with Firebase.
Thanks in advance!
Edit April 22, 2019:
Recently, Google Cloud released Cloud Scheduler, which allows you to schedule HTTP requests or Cloud Pub/Sub messages to functions that you deploy.
This new service works also very well with Firebase and for that I recommend you read an excellent article writen by Doug Stevenson on the Firebase blog named Scheduling Cloud Functions for Firebase (cron).
Is it not possible to have a code in the "background" who will be called every 24h?
Yes, it is possible. In this case, you should write a function in Cloud Functions for Firebase and call it whenever you needed. If you want to be triggred every 24 hours, use the follwing service:
https://cron-job.org/en/
This means that you can do that particular calculation even if the user has the app closed. For a code example, please see Frank van Puffelen's answer from the following post:
Cloud Functions for Firebase trigger on time?
For your case I'd recommend using default Android tools for scheduling jobs. You can try using a new WorkManager or just a JobScheduler. Also you can try digging into this article to get more information.

Continuous Android Background Service [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm interested in finding out whether it's possible to implement the following:
1) Run a service every 24 hours at a specified time.
2) Launch a method from the service that does something.
I'm assuming that I will have to run a background service, but I don't want the user to have to initiate it in any way. It should be running constantly from the moment the user logs in the first time, and cannot be disabled. Could I use Android AlarmManager (https://developer.android.com/reference/android/app/AlarmManager.html) and disable the alarm response?
You can request the permission for android.permission.RECEIVE_BOOT_COMPLETED and register a BroadcastReceiver for it. But you can not enforce this onto the user, he may stop the app and the service forcefully.
You don't have to notify the user if a service is running or starting, this is optional but not advisable e.g. unknown battery / network consumption.
Instead of going to Alaram Manager you can use handler to perform your task every 24 hours...And the RECEIVE_BOOT_COMPLETED would only be triggered if the device is rebooted, hence start the service also during login...Whatever be the service it would be destroyed manually...

Checking server every 5 minutes [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I saw 2 approaches to check a server in Android every X time, therefore I want to ask which way is better.
My application is requesting a HTML page from a server.
First option, is to run a service with sleep time of 5 minutes.
Second option, to set an alarm manager with interval time of 5 minutes that triggers a broadcast reciver.
Glad if you can tell me which way is better, or if there is a better way.
Thank you.
I would suggest using AlarmManager and set alarms every 5 minutes and use a BroadcastReceiver to get the message.
My reason is that when you run your service in the background, if OS needs more resources it will kill your service and get its resources for other apps but with Alarms you reduce the risk of killing your app.
Regarding checking server, you should consult this manual. just a single poll request to the server will make your radio active for at least 30s and will consume your battery. So maybe you should reconsider your intervals or even your strategy.
One other note: If you are just checking the server for new data and want to be informed if something has changed you can use Cloud Messaging. You can do most of the processing in the cloud and just send the important data back to the device(s). It is more efficient
i agree with #Pooya. Also you should implement a boot receiver so that your alarm will be set if the phone is rebooted. Here is the sample app that i downloaded from http://developer.android.com/shareables/training/Scheduler.zip

Categories

Resources