Android Question New data in remote database = notification

Oke

Member
Licensed User
Longtime User
I have a database on a hosting server.
How do I make every time new data is inputted into the database, I get an automatic notification ?
 

Alex_197

Well-Known Member
Licensed User
Longtime User
I have a database on a hosting server.
How do I make every time new data is inputted into the database, I get an automatic notification ?
Firebase Notification. Let's say on the server there is either a running application or a web site that creates the new data. Let's assume that we're talking about a website written in ASP.NET. User clicks on a button on the webpage and a new record has been created.

Now on record created event we can run a code on this web page that will send a notification to the B4A app.
 
Upvote 1

Oke

Member
Licensed User
Longtime User
Is it possible to check new data from b4a app?
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
If you are using a general shared server solution like around 99% of businesses/people do, then jRDC2 is definitely not the solution for you. In the last I've just set a 60 - 300 seconds ping to check for new data, It's as simple as that.

Most simple website services give you free hosting databases (but no desktop access), so you should define if you have access to the actual desktop. A simple pinging the database every x seconds should suffice.

I can think of lots of solutions, this is just one of many simple solutions that popped into my head. Firebase Notifications is another solutions, but you will have to do a lot of work to get everything working smoothly.

I take it that you're using either MS SQL or MySQL???
To me you've not really described anything, do you need instant notification, or can it be delayed 5 minutes (maybe not)...
 
Upvote 0

Oke

Member
Licensed User
Longtime User
yes using MySql,
Can you provide a sample code to ping a server in the B4A app ?
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Just use B4XPages with a timer, then just use your usual connect to database routine to check for new data. There are other things that you'll need to do to keep the app running in the background, but this is a good start for you...
 
Upvote 0

Oke

Member
Licensed User
Longtime User
Just use B4XPages with a timer, then just use your usual connect to database routine to check for new data. There are other things that you'll need to do to keep the app running in the background, but this is a good start for you...
will it not burden / disrupt the server ?
 
Upvote 0

Oke

Member
Licensed User
Longtime User
Just use B4XPages with a timer, then just use your usual connect to database routine to check for new data. There are other things that you'll need to do to keep the app running in the background, but this is a good start for you...
need to do to keep the app running in the background,
how not to be turned off by the system ?
 
Upvote 0

MikeSW17

Active Member
Licensed User
Longtime User
will it not burden / disrupt the server ?
You don't need to download/read all the data every time. Just implement a single-record table on the server with a LastUpdateDateTime or SequentialCounter. Update that whenever an add/change/delete is made to the main data. The remote App can just periodically read & compare that with it's currently stored value and do whatever when it changes.
 
Upvote 0

Oke

Member
Licensed User
Longtime User

thank you sir, i will try
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
WHERE DID I SAY DOWNLOAD AND READ ALL THE DATA???
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…