Creating notification based on table insert in Android - java

I am new to Android and my requirement is this. I am in need to develop an application that will list all the events (past and upcoming). These event details , I will fetch from tables and that table will have only past events. For the upcoming events, I will be inserting into the table which will create a notification for the same.
My doubts:
What is the table I should use (SQLite(inbuilt) or MySql from any hosting services) ?
If SQLite, Is there a way from GUI, I can insert data so that it will reach all users having this application?
To be simple, how I can achieve this entire functionality?
Thanks in advance!!!

What is the table I should use (SQLite(inbuilt) or MySql from any hosting services) ?
If you want all user devices to access the same database, you will have to setup a MySQL server. As soon as the database is updated in your host, the changes will be reflected in the users apps - as soon as they reload the view or a new request is made. You can query your database every N seconds to keep things updated.

MySQL will be my choice or MariaDB, MySQL's community fork.
You can start with this tutorial:
http://dev.mysql.com/doc/refman/5.7/en/tutorial.html

Related

SQLite - Database minus list of values

I am working on project where I need to load data from local mobile DB(SQLite) to UI in meanwhile load data from server and when data download is finished insert the data from server to the database and update UI. I searching for way to download data from server and instead of delete all data in database and insert the new valid data just find the changes and "update" database. Is there some correct way to do this. I am working with SQLite database on Android phone.
SQLite isn't an online database meant to be ran on a server.
There aren't any free SQL Server options that I know of, but the NoSQL options include Firebase Realtime Database, Firebase Cloud Firestore, Realm Platform, Couchbase Mobile, Parse Server, etc...
Each of the listed options allow you to listen only to changes in the data. SQLite does not provide this option itself.

update database of an app from another app in android

I need to update and insert rows in Sqlite from another app. I am working on an android app and I have to update database of another app,how can I do that,is it possible to access and edit another app's database from my app.
You should look at Content Providers. From the android official docs
Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process.
Android Docs explain how you can use it.
I understand what you are trying to achieve. correct me if i am wrong. You are developing android application in which you are trying to update your application database by fetching data from some different database. right? if yes, you have to get details of the database server /database connection details from the database owner if possible. in case if the owner of the database is not providing or not ready to give you credentials/database connection details then confirm whether they have any services/webAPI/web services through which they expose database data.
If they have webapi/webservices available then you can easily consume in your andriod application and do what ever operation you want to perform.
Hope this helps..

SQLite, MySQL or Both for Android Application

I'm in the process of designing an Android application right now.
I understand SQLite works on the phone device within the file structure. However I'm not sure if it's practical for our use.
If I'm wanting to store data that's available to all users (i.e. if someone updates their profile, it can be seen by all other users), can that be done using SQLite somehow? Or must we use a client-server model such as MySQL?
Is it practical to store user-specific information using SQLite and public information using MySQL?
Thank you
What you want to do is a Client-Server Architecture, store the data in your central server and get a copy of the working data on the phone. MySQL and SQLite don't share everything but it's close. Read the documentation on SQLite and you will see.
SQLite can't serve files like MySQL if that's your question via the network. You'll have to write that on your own. I suggest making a webservice.
If you want info to be available to all users you need a client-server model such as MySQL.
If you use SQL Lite, the only possible way to update that info without requesting it from a server is to make an Update on the application (not doable).
Don't forget that you'll require internet ON for these types of applications.
you mean all users going to use a single phone, probably not, the reason for recommending sqlite database for android is that its the lightweight, non memory eater and thus best suitable to mobile phones. Sqlite database can be used in phone while at server side we can use any. The only thing is use a method like sending xml request to server from phone, where server will send respond as xml or json, while the phone parse the xml and use the data in it. this is how online apps works in mobile phones..... ya ofcourse use mysql at server side and do the communication using as request - response yes the client-server.
Is it practical to store user-specific information using SQL Lite and public information using MySQL?
Yes, This is exactly what I'm doing with my app. It's a very common practice. I am storing information in a MySql db stored on a server that all users can read from. They can pull specific information to the device. From there I have a class in the app that stores information that they've selected within a SQLite db. You'll easily be able to add information to the MySql db on the server that all users can view.
yeah i think the model you are proposing should have no problem. Even i'm using a model something similar to what you are saying. I store some information on local sqlite db and majority of information in mysql db. For sending data from android device to mysql db you will have to write a mysql scipt on a page and android device will hit that page with the help of http request. You can send your data in that http request

Java bridge between PHP and Database

First, I will present what it is doing my web-application :
The subject of this web-application is different distributed databases and distributed data sistems with a specific type of information. Until now I programed using PHP, JavaScript and JQuery-ui. For databases I used MySQL and PostgreSQL and I thinking to use and Oracle. On short way on my web application the user firstly have to register. If he is accepted by Admin then he have the possiblities :
Connect to HIS database (MySQL, Oracle, Access, PostgreSQL)
Run queries between two, different or not, databases
To connect to his database the user enter information like : host, user, password and name of database. At next step he can see the tables from database. If he select one line he will be able to Update, Create and Delete the content from the selected table.
On this section the user can look for similarities between the two databases (with key words or structures of tables) : one that belongs to him and another one that belongs to the Admin.
I use WampServer, version 2.1 with Apache/2.2.17 and PHP/5.3.5 and I want to do a bridge who will be responsable with the connection to the databases and in which I will comunicate with different databases. The informations from interface will be sent as MySQL queries and in the bridge I will adapt that queries for each type of database.
Can someone to help me ?
Soon as possible.
Thank you !
Simon
The informations from interface will
be sent as MySQL queries and in the
bridge I will adapt that queries for
each type of database.
This is a very bad idea for two serious reasons:
To implement it, you'd have to write your own SQL parser.
Each major database implements its own dialect of SQL, which means you'll have to know how to translate between their specific syntax and command sets.

mysql alert that it has been updated in PHP

I want the user to be informed that database is updated. I'm using PHP and mysql. There is a process behind which updates information in database. Once the process (java application) updates the database, how can I tell user the that they can view the processed information?
I don't have any idea at this moment how to do it or even is this possible?
You will have to check some script periodically (assuming your endclient is an webapp - probably using javascript) and raise an alert once the script returns the DB has been updated. Have a look on jQuery polling.
you could trigger ajax requests to poll information from the server, or you can try to use websockets to let the server
I've not fully understood your question.
If I've understood, you have a job that updates tables in the db.
While the job is running the user is not aware that the data are being updated and when the job has ended the user is not informed about.
I don't know if you can handle the tables, what kind of data are there, and if you can manage/control the java app...
If data and tables (and java app) are under my control, I will do the following:
create a table called job_in_progress, with some fields like running as boolean, started_at as timestamp.
modify the java app to update that table writing true in the running field when started, and writing false when ended.
when the user goes to your PHP page, you check the job_in_progress table, and if the running field is true, it means that the java app is still running.
Another way: send an e-mail to the user when the java has ended (if the update process is heavy).

Categories

Resources