i want to create an app that uses a database already completed and filled with name and numbers, in detail this app only reads the database and filter some data, for example shows me only "male" contacts in the database. I want to use that app on different phones, so the problem is to incorporate the database in the apk..what kind of database i can use?
You can store the database on a web server and get the data at first run of your app to store it locally. You can find a good tutorial for retrieving data from server at http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/.
Document Orientated Database - A document-oriented database or document store is a computer program designed for storing, retrieving, and managing document-oriented information, also known as semi-structured data.
Related
I wrote an app that saves and uses data in/from a Cloud Firestore database. I would want to organize more clearly than for the moment my files, for example by using DOs and DAOs.
I know the concept of "DAO" exists in Android Room.
However, the documentation seems to define Android Room as a "local database". So if I understand it well, I shouldn't use it in addition to Firestore?
By the way, it would be the same with Firebase Cloud Realtime Database (a third database system).
Edit :
I didn't understand the notion of "local" database (Room). Tamir, in his answer, corrected me. This question is off-topic.
So if I understand it well, I shouldn't use it in addition to Firestore?
No and this is beacause Cloud Firestore has offline persistence enabled by default:
For Android and iOS, offline persistence is enabled by default. To disable persistence, set the PersistenceEnabled option to false.
This means that you'll have by default a local copy of your database. So there is no need to add another one.
Basically, when you are developing an app there would be some data that you will want to save into locally and other data that you will want to save on remote database, it's not a bad thing to have both remote and local database.
Some example that I can think of for saving your data remotely is to manage users - when a new user will be created you will want to check if the username is not taken, and you can't do it if this data is only stored locally.
And for using a local database - one of the major advantages in the local database vs remote database its the speed of writing and receiving data.
Here is a nice article on the subject.
I'm very new at programming. I want to make an app where,
1. User1 will make an order (log in as user_profile_1)
2. User2 will work with that order (log in as user_profile_2)
One user shouldn't have access to other's data.
Will SQLite allow me to do that? Seems, database must not run on user's device. And database will always get new records, so we need to update it all the time.
For this case, you have to create a server to store data, I think you should do these things:
Use PHP, NodeJS or some languages server like this to create APIs.
Use a MySQL database or some other database to store data on your server.
Then, different users can log in on their device and you will call your APIs to show what you want.
If you use a SQLite database, the db will be local in the device. The records in the database do not share with other devices.
If you want to access the database from different devices the database will need to exist in a remote server.
You can do differents things:
You can use a database MySql in a remote server with allowed remote access.
You can create a rest api in a LAMP server. You can do this for example with PHP and MySql. You create a GET/POST web page, them pass the data, and the php save the information in the database. You can get the information from the database in the same way, but you should ask to the db in a periodicly time
I'm developing a chat application in Java.
The architecture used is Server - Client(s) architecture.
The majority of the code is in Java, JavaFX for the GUI and PostgreSQL as the Database.
As this is a chat application (desktop), I'd like to know which is the best way to store chat history:
Locally in a text file, that the client has to read every-time
In the database as of type String (VarChar)
In the server as Lists
Some questions based on the three ways:
If a client connects from a different machine the text file will not be there
Is it possible to store every text entry in the database with a chatroomID?
How many objects can be stored in the server for as long as it runs?
Out of your three choices, I recommend you choose option #2 for storing chat history: A database, and here is why:
If you store the chat history locally in a text file, you run into issues such as how to sync with others. Also, you can modify the contents of the text file without going through your Java program (such as with an editor). If this file contains chats with sensitive information and someone has access to your computer, they can read it. This spells trouble.
Storing in a database is a great idea because it provides a central location for all your Java program. This is especially handy if multiple people are using your Java client, that way they can fetch chat history, as well as easily transfer chats to others! I wouldn't only use a type String (VarChar), but try to think of some other useful fields or columns that might be useful (i.e. timeSent, chatUserID, timeRead, etc). This also brings up the point that by using a database, you are able to set up some sort of user access rights (username and password) so that specific people can read specific chats.
If you store the chats on the server as a list within the Java server itself, and if your server restarts, you lose all your chat history. Bummer.
To sum up, keeping your Java client-server-database architecture is perfectly fine, and technically all 3 options could work, but databases is the way to go for storing your chat history! Even if setting up the database takes a little bit of work, it proves to be superior in efficiency and security out of the other 2 methods described since databases are built for archiving data.
I'm in a similar situation, I'm also developing a chat from 0, the only difference is that I'm doing it for iOS.
The way I'm developing my chat is:
I use an Ubuntu web server.
The server has a database in Mysql and the communication with the user is done through NodeJS.
In NodeJS I have a socket "Socket.io" which facilitates notifications between users.
On the iOS device, I store all the messages that it receives in Core Data, which is an extension of SQLite.
In order to obtain the pending messages depending on the device where the user is connected and I use an ID for each device, this ID is created and identified by the MAC physical address and thus what messages to obtain from the server and what not.
Initially I base myself on this database to know how to structure my application: https://github.com/yoosuf/Messenger
Socket.IO is incredibly easy to use and the best thing is that it has libraries for different programming languages, here is its page:
https://socket.io/
https://github.com/socketio/socket.io
I would say Nr2 - for safety reasons (if you care about it) and because it is a pretty easy way.
For the beginning a database with 4 columns should be enough (Date/Time, ChatroomID, UserID or just a name and the message itself). If a user sends a new message it creates a new row containing all the information that is needed for the columns. You can easily iterate through it as well when your client reloads (maybe every 10 seconds)
I trying to post data from android SQLite database to MySQL database. I come cross many reference. My question is can I post data from Android SQLite database to MySQL database without Json? Json seem very complicated since I don't have a any Json knowledge.So far I can store data in SQLite. I need to post all my data to MySQL. Thank You.
It is a good question.let maximum people get benefit out of this. When you are using a mobile either it could android,IOS,windows no matter what ,the device has to interact with the server in order to exchange the data stored in the server.If you want to browse you need an active internet connection. can you browse without internet on a mobile?? i don't think that technology exist. Similarly, there are only two ways how you can interact with server from mobile devices. XML JSON Typically these act as a bridge between two canals.
XML:
The data can be transferred from mobile to server and from server to mobile using XML.This is the traditional one.May be first evolved technology.But it is heavy weighted.
JSON
This is the advanced technology. Very Light-weighted,quick and easy to learn.Easy to parse. JSON is the common framework that is being used now-a-days.
And when it comes to your question:
you cannot cross canals without a bridge or a boat. which is JSON or XML in your case.
I am new to Java and Android. I am just beginning work on an app that will save information to a server that someone else from within the same company can retrieve using the same app from a different android device. I know how to simply store data on a server using simple php scripts but this is a bit more complex and involves one user writing information to the server, while another user can see / download it. Within a company there would be multiple users who have acceess to this data. So my question would be, whats the best way to implement a company-wide database that ONLY members of the same company can have access to? Sorry if this seems obvious to some of you. I am just getting started and I have 7 books on android programming and none of them describe how to do quite what I am trying to do.
To do this you need to use Android network services to access data. In other words to retrieve a networked database information your device will connect to your service with a specified URL and arguments. In turn, the service will reply with the required data, say may be in XML format. All your app needs to do is parse the XMl and display the date as desired.
Same thing applies to putting data into the server, in this case however the data will be sent as arguments to the network service URL and the service will handle the persistence to a database.
My advise is to do a Google search of the keyword "Android Network Services".