Android strategy to store data - java

It may sound as if I am rambling (which I am anyways)
So I am thinking to create an android app which basically query my server to fetch some data based on user criterions and display it to the user (think of Yelp for example). User can push data also to the server (like ratings, comments etc.)
I want:
I want the app to be available in offline mode also (i.e. no network connection)
I can do it because:
Server side data will not be refreshed that frequently so no point in redirecting every request to network. For client updates however, (like when users gives a rating) I am not sure what to do. Should I immediately send it to the server or persist it in my local datastore and send it in periodic fashion?
How I am thinking of doing it (this is where I am confused)
Thinking of using phone storage to store data in SqlLite database?
How can I sync local db with cloud datastore? So that whenever connects to network or after a certain timeout period both client and server are in sync?
What should I use for cloud storage? How about Google App Engine?
How do people generally approach it? Looks to me common questions.

1. Thinking of using phone storage to store data in SqlLite database?
You can do just that, but i advice you read up on the other solutions plus the pros and cons about storage in Android here
2. How can I sync local db with cloud datastore? So that whenever connects to network or after a certain timeout period both client and server are in sync?
You can store the offline db (sqlite) data on a file and then upload (more like "backup") to a server (which can be Google App Engine) when you get Internet connection.Read more on this here
3. What should I use for cloud storage? How about Google App Engine?
Google App Engine is perfect for your backend server. this is the official documentation.You can also find tutorials on creating a Google App Engine connected Android app here

Related

Is there any way allows my Android wear connect to MYSQL

Just like what I mentioned from the question.
My watch is LG Urban, when I was developing my android app, I can use the mysql connector to connect with my DB server. Can I use the same to make my Android wear connect to mysql?
Thank you!
Starting with Android Wear 2, proxying data requests through the phone has been replaced by direct network access from the watch. So going forward, your existing code to connect to a MySQL server should work essentially unchanged on the watch.
More details here: https://developer.android.com/training/wearables/data-layer/network-access.html
A couple of caveats:
Wear 2 is only now rolling out to the majority of devices (your Urbane probably doesn't have it yet, for example).
You should try to minimize the data being transferred to/from the watch; these devices have enough issues with battery life as it is.
You can talk to the DB via the phone. You can send messages back and forth and also sync data to the wearable.
You could therefore - indirectly - get whatever data you want from the DB and display it on the watch. You could also get sensor data from the watch and save it back to the DB.
https://developer.android.com/training/wearables/data-layer/index.html

Firebase Java SDK offline

How to use Firebase java SDK (To Desktop applications) offline? Is possible? I need this function to use software desktop offline and sincronization with Android using Firebase.
The Firebase Java SDK will handle intermittent connectivity loss. It will simply keep the data it's already received in memory and will queue any local modifications in memory until it has a connection to the server again.
This data will be lost when the user restarts of the application. There is an option to persist the data to disk, but that is only available for iOS and Android.

Android SQLite and Desktop Sync

I am unable to figure out what is the best way to achieve a scenario like this:
Working on a project that would have android application as client.
User will take their device with the android application installed to field/visit and capture/punch/key data through out the day. This data would be stored locally on the device in SQLite database.
The data captured in SQLite needs to be exported out and imported into the desktop app (it could be java or .net based) for further processing.
Other points:
A. User could connect the phone via usb to desktop.
B. data flow would always be in one direction (i.e. Phone to Desktop).
C. No internet connection on the phone
My dilemma is how to access the sqllite database programmatically in desktop application? Are there any JDBC drivers that could read data from the sqlite database from a device connected via USB to the computer?
This is just a way to do what you want, there are more ways to do it but from my point of view is the most accurate and scalable.
You would have to make a webservices server on Java, PHP, etc ... with a database MySQL, MongoDB, etc ... and so the mobile device is synchronized with the database that was the cloud.
Thus after a desktop client would connect to the webservice to bring the data in order to process it on your desktop client.
EDIT:
You can view this post's
send-data-from-android-to-pc-via-usb
transferring-data-usb
bi-directional-data-transfer-through-usb-between-an-android-device-and-a-pc-mac

Is it Possible to run both Server and Client android applications Locally?

I'm looking to program a network application. I was going through: http://www.stanford.edu/class/ee368/Android/Tutorial-3-Server-Client-Communication-for-Android.pdf which talk about server and client programming for android. Now imagine I don't have an internet connection and I want both server and client applications run on either same android device or different android devices locally.
Is it possible to develop and run both server and client applications using TCPIP/UDP/Multicast locally on either standalone android device or multiple android device?
Yes, it is possible to communicate between Android devices or applications that are not connected to the Internet.
If you are using different devices, you probably want to use sockets, but it is possible to run an HTTP server on the server device and then use HTTP. Make sure they are connected to the same wifi network.
There are several different ways to communicate between different processes on the same Android device. The easiest might be to use a Messenger service but sockets and HTTP are also possible here.
Yes, it is possible in some manner.You can either use sqlite database present in android device to store various types of data in table form and data retreive from same.
Another way is to use Parse cloud as a server or backend of your client application.It allows your app to run even when you are not connected to internet.It stores the data in cache memory with its api and then uploads data to the server cloud as soon as you get connected to Intenet.
You can ask if you have any further queries. :)

How to authenticate a user over network in Android App without replicating data on Local Device?

I want to know the way to query a database to authenticate a user over network. I am not asking for any algorithm which is described in the posts like this Handling Password Authentication over a Network.
I have also taken a look at sync-adapter in android but I need authentication to be successful over the network before going ahead to Sync.
Here I explain it. I want to do so to avoid this problem.
I do not want a user to replicate GBs of data from server first and then authenticate in application db. I just that user will be authenticated over the network and then the data relevant to him only will be replicated(filtered replication)/synced on his device. So while authentication no data will be available on local device database.
Yes, What you can do is by using rest api there are few good libs avail for android.
Use those to send auth request and once it is authenticated on the server return true.
Once this done you query the server to get user data, then once you retrieve correct data form the server store it to your database, once stored get the the timestamp or the time and save it to ur database, and for the next time use this for query server if there are new record created in the server after this time stamp the return data or return nothing. so this will save your extra work.
Rather i would suggest you to implement google cloud messaging server on the server to notify.
Form more detailed architecture refer this tutorial :
http://developer.android.com/training/sync-adapters/index.html
http://developer.android.com/training/cloudsync/index.html

Categories

Resources