I've some knowledge on databases. I've used them for some android projects, but recently I am in the need of making a website in which someone can see the data of each table that is accessible to them. The problem is that they must be able to change this data, and this change must replicate into the android app that the users use to upload their data.
E.g:
Users upload their ringtone, someone using this website decides that they need ANOTHER ringtone. It is changed, and now this change should appear on the other person's phone and be used as the ringtone. This must be instant because speed is crucial. Please tell me if you know of documentation or something similar to this. Greatly appreciated.
This is easy. Use a SQL trigger to populate an audit table. Then a service to process the audit table and send push notifications to mobile. Push notifications are instant. The service can be configured to process every 10 seconds or so. You can tweak the service interval but whatever you do, do not try and send the push notification inside the trigger. Use the audit table.
Related
I am developing an application that sends a notification to your phone when other devices sends data to a joint online database. Anyone know how to do so?
Think of the workflow:
Another user adds data to the database
this triggers some sort of action
this action should result in a push notification
What you have to think of, is how 1. becomes 2. and how 2. becomes 3.
1.->2.: This is a part of the server side application. If it is a database only, you can use triggers to write a row into a notification table. If you have an applications erver, it's much more efficient to let things run there. The easiest (while least feature-rich) version is to increase a "Generation number"
2.->3.: Basically you can chose between the app implementing a background service, and in it poll the server for notifications or use the platforms push notification facility. The former decouples you from the vendor's platforms (which I consider a good thing). Again the easiest version is to just query the generation number and compare it to the last seen one - if it is higher, then somebody entered data and you can notify.
I'm building an app that currently can receive data from an SQL database through the click of a button.
How can I automate the app (so I don't need the button) so it receives the data constantly (or every x seconds I don't mind) and then sends a notification to the user if certain data has come through. I need the data receiving and checking to be done even when the app is minimized/not on the user's screen. I've heard talk of using 'services' but i'm relatively new to app dev so no idea on the matter.
Any help appreciated,
Cheers.
If you're new to android programming is a bit complex but you can implement this functionality using:
- Services: sends request to the server every x seconds(manually)
-Sync Adapter: (you need to know services ) android mechanism for doing exactly what you want.
More at: https://developer.android.com/training/sync-adapters/creating-sync-adapter.html
EDIT: you could also use firebase to send push notification
So push notifications are needlessly complicated for such a simple thing and I can't find a good enough tutorial for it (I actually need to collect ids for every person who installs my app for it to work?? why is there no "all" option?) so given that my new content is posted at very regular intervals I can just make the app wake up at specific times to download the new content and alert the user... is there a way to do this? It seems like it would be a lot simpler.
I know how to do the code to check for new content, what I need help with is figuring out if there's a way to get the app to wake up on its own and run an asynctask to check for updates if the app is not currently running.
Is this possible?
Actually you can use Parse Platform for Push Notifications ...which Automatically triggers all the phones which has installed you Application..
Here is tutorial :
Android Parse Push Notification
So I have a desktop app working with an MySQL DB. I need to include a notification system inside that desktop app, allowing the desktop users to send notifications to a set of 10 tablets. So it's like sending SMS, but not really.
So the tablets users must receive the notifications sent by desktop users and the other way around, tablet users must be able to send notifications to desktop users.
Since the common ground between the two is the MySQL DB, I thought of the following schema:I would need to build a notification service, that will run all the time on the tablet after I run it once. It should check a remote MySQL table to see if new records are inside, and if so, then display a notification on the tablet.
I am sure many of you experts have done this at least once.
So the path I thought of is:
I have a MySQL db on a server, and I have an application (desktop) that allows users to input a notification (a new record) inside a mysql table.
Build a PHP backend that will serve my Android service with "yes" or "no" answers and a second PHP that will return the data of the notification upon request
Build a service that will make a call to that PHP every minute
In case "yes" is received by service then make another call to the second PHP asking for notification data
With the response, create a notification on the device and show it to the user.
Now,
First of all,: is my logic ok?
Second: How do I create a service that "installs itself" and remains installed and running all the time on the tablet? I've been trying the tutorial from here but the service does not do what is should. Perhaps it's because of RECEIVE_BOOT_COMPLETED ?
Third:Should I make async calls to the PHP, or is it enough to make simple calls, since there is no Activity/Intent that would freeze until receiving response
Fourth: Is it possible as I imagined to have all this as an independent service, so not an Android App that the tablet users must run and keep open?
Is there any good example out there of a service like this?
I found an example of something very similar to what I want (I think) but I have a few questions about it. So the tutorial is here
My questions are:
1. Will this service start on Android startUp ? Or do I have to do something extra? What would that be?
2. Where do I place my call towards PHP?
Please help me,
Thank you
I would suggest that you make your database on the tablet a ContentProvider.
Then you can implement syncing using the sync mechanism.
http://developer.android.com/training/sync-adapters/index.html
To trigger the update on the devices look at Google Cloud Messaging.
http://developer.android.com/training/cloudsync/gcm.html
I haven't done this, but I have been researching it :-)
I'm making an app that remind a close forum with something like 100 users. Every time a user is asking a question, the app needs to send notification for all the users that taking place in his close forum, that going to be a lot of notification that send Simultaneously.
Does anybody know what is the best way to set that kind of notification in android? Maybe every time the database is updating, or update the user app every 3 min. I need that the users will get the notification as soon as they can.
Thanks!
Notifications can be broadly put under two categories push notifications and pull notifications.
Push: This would require server action based on the event, check Google Cloud Messaging
Pull: Where you run a service on the device and keep on pinging the server after a certain interval for data.
In your scenario, if the notification required is not real-time you might want to go with Pull notification albeit with something like 10 minutes interval even more. Lesser the interval, more battery and data charges for the user. In case real-time notification is required you can go with Push.
If you have acces to web resource you can use GCM (Google Cloud Messaging, http://developer.android.com/google/gcm/index.html) to push messages to your android clients. So it will not drain so much power, as pulling mode.
If you have not, the best way is to retreive data by some interval and notify user about data changing. Also you can retreive only header Content-Length and compare with previous value to prevent for loading all page