-2

I am having a problem with my Kotlin app.

It has a connection with an API written in Node.JS, that gets requests to handle data from a SQL Server Database.

2020欧洲杯手机版注册But I need to listen for database changes, I want my app to send notifications when database is modified.

I've read that I can do it using broadcast. But how?

My broadcast receiver and my alarms are ready, but what can I do in the API to verify if there was a modification at my database?

2020欧洲杯手机版注册Please answer, even if you only know how to do it in Java, it can help me too.

New contributor
Emilio Sanches is a new contributor to this site. Take care in asking for clarification, commenting, and answering.Check out our Code of Conduct.
  • No, it just works for SQLite databases, I need to use it on a SQL Server database that is hosted on cloud. So I need to do it using my Node.JS API. – Emilio Sanches 2 days ago
  • sorry, I didn't understand. Can u explain it better? – Emilio Sanches 2 days ago
0

What you are describing is a little complicated, but certainly possible.

You would need to implement a 'subscribe/notify' pattern (or something similar), where your android app would subscribe to the web service, and when there is a change in the database, your webservice can notify all of its subscribers.

is an easy to use, ready to go library for achieving exactly this in Node.js.

Another option you can explore is You would need to do some configuration to connect your SQL Server to Firebase, or even migrate your database over to for the purest integration. Of course all these options depend on your use case, and what makes most sense for you.

Don't confuse all of this with This is a mechanism built into Android which allows the OS to communicate with all applications, such as broadcasting that WiFi has been switched off, an event certain apps may want to know about, and choose to subscribe to.

  • What do you mean with "some configuration"? I need to write a code to sync my SQL Server database with a Firebase database? Or there is another way? Is there any example code or tutorial to help me to do it? – Emilio Sanches yesterday
  • FCM would be your tool for notifying the app of changes to the database. In your API, whenever a DB change is made, you can then send a message to FCM, which would handle notifying your android app that there is a change. Once your app receives this message, it can act accordingly, such as refreshing the data. All the documentation and code samples can be found inside the FCM documentation. – Ryan Saffer yesterday

Your Answer

Emilio Sanches is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy2020欧洲杯手机版注册

Not the answer you're looking for? Browse other questions tagged or ask your own question.