Syncing SQLite table over devices - android

Is it possible that I store my SQLite table over a dropbox account and have all my users sync their tables with the stored table? Also be able to make changes to that table?

Your approach could work in theory, but there are so many issues involved, that you're better off not doing it. If you wish to store and make data available across all devices belonging to a user, I strongly recommend looking into Datastore API by Dropbox. The API will take care of storing data locally as well as synchronize it over connected Dropbox accounts.
If you want a bit modular approach, you can use Windows Azure Mobile Services. These give you REST APIs to store your data in cloud. However, synchronization has to be handled by the developer - you. I have written a small library to do that here: http://bit.ly/ProjectMirror It's for Windows Phone, but Android version is already in a sister repo there. You could extend it. Let us know how that goes.
In addition to these services, Parse SDK is a good option. It requires you to pay after a while, though. In addition to what you want to do, it also provides other things like user management and so on. But, be aware that some of those operations may require you a live Internet connection.
So, in essence, if you want seamless data storage and sync, use Datastore. Be aware that you'll have no control over the server side. Also, your data will be restricted to the Dropbox ecosystem forever. If you plan on further expanding your app to other platforms, go with Azure and handle the sync. If you want lots of features, go with the Parse.

I would suggest looking into Google Play Game Services using the Cloud Save feature. Even if you are not building a game this feature lets you sync sqlite data in the cloud and Google will handle most of the work for you.

OR you could use a cloud based database which supports both push and pull. That means:
Scenario 1:
Your users change something on their phones. Changes are uploaded to the database. The database then pushes these changes to all other users.
Scenario 2:
Your users change something and upload this to the database. But instead of the cloud based server pushing the changes to all users, the users phones can ask the database for new data at intervals.
All this is very easy to set up. It took me about five, ten minutes. Just follow this easy tutorial:
https://parse.com/docs/android_guide
and for push:
https://parse.com/tutorials/android-push-notifications
We now use this for our company app, storing statistics for example.
Bear in mind that syncing can become complex. Try to keep it very simple, especially if you are new at programming.

Related

Connecting to Data Store from App Engine and Android Studio

The Goal: I'm working on a simple project with Android Studio and Google App Engine. The App is just a Proof of Concept, so nothing spectacular. In a sentence, it is an app that counts the number of times a button was clicked in a six hour interval. Specifically, when a button is hit, the app needs to send a request to the backend. The backend then needs to load a number from cloud storage, increment it, and write it back. Every six hours, I need to reset the counter to zero.
The Current Progress: I have the app UI written, I have an App Engine Project set up, and I have the two connected via endpoints. For now, I have a method to send two numbers to be added in the backend and return it. I'll scrap that and go with the incrementor code when the time comes, but I can say I understand how App Engine and Android are connected.
The Problem: How do I access Google Cloud Storage programatically from here? Do I write backend code? Do I write code in the App itself? Do I do some more endpoints wizardry?
I keep seeing code excerpts, however, I don't know how everything fits together. I can access cloud storage from the online manager, however, that doesn't do much good I don't think. I understand how buckets and entities are broken down as well, if that helps.
Thanks in advance, I've been wandering through the desert of Documentation for weeks.
It's a little unclear exactly what you're trying to accomplish, but I'll take a crack at hopefully nudging you a bit more in the right direction.
First off, if you're just needing to load and increment a number, in my opinion, you may be far better served using a database, such as Google's Cloud Datastore, rather than Cloud Storage.
There are numerous options for connecting, whether you end up on Cloud Datastore or Cloud Storage. You may find it easiest to implement your Storage/Datastore operations on App Engine, but that really depends on what else you're doing.
If you app just needs to do basic database or storage operations, I wonder if you might not be far better served by a more managed solution like Firebase. With Firebase, you get many of Google's cloud services, nicely wrapped in an API that is very easy to implement, thereby negating the need to manage a separate App Engine instance and your endpoints. Firebase also gives you offline and caching functionality.

What are the limitations of syncing data to Google Account?

Is there any downsides to using Google Account? Is there any limit?
Why ask this? It's because I played some android games for research and found out many of them don't save the user data just warning the users removing the games will remove whole data as well.
Ironically, all of them provided world rankings using Google Accounts.
So, I became curious and wanted to get some opinions of experienced people if there is no problem for beginners like me to use Google Account for backing up data.
The data is going to be created with SQLite so I cannot let users save in their own SDCards. If Google Account is not good for saving data, I need to get an FTP server instead. (I'm not sure if I can deal with it well, though.)
But I really wanted to use Google Account, so was just about to start to study it.
Can I just use Google Account for user data? or better to get my own FTP server?
There is something that Google offers which is known as the Android Backup Service. It's precise use case is when you want to save user's data online. There are several advantages to this:-
Easy API to call Backup Service
No need to maintain a separate FTP server, hence reduced cost saving both domain and hosting charges.
Unlimited Backup space for your user's individual app installation.
In case the user deletes the app, your app's data can be retrieved from the Android Backup service.
The developer page gives a fair amount of idea to anyone wanting to implement that kind of data backup support cost-effectively.

How to sync data between different devices

I am planing to implement an app and I have come to a point where I don't know what is the best approach.
Scenario:
I have an app where I am making a todo list and I am adding 3 items. I use my phone for this.
Then I take my tablet and want to continue adding another task. Then after a while I take my wife's phone and want to add 2 new tasks.
Basically I want to have a very simple way of storing the tasks online and be able to sync it with the app.
I am seeing two possible ways:
have a web server with a database + web service calls. This has the disadvantage of having a host paid, learn some extra mysql + web service techniques.
store somehow the data on cloud and allow the app by login to access an account which stores the file. I am thinking here at something like Google Drive / Dropbox. But I don't know how I would be able to sync only the updated values, not the whole file. Because I am thinking, if I store all the tasks into one file, each time I update the file, I'll need to upload it fully, which is not the best approach.
I am open to any advices. What approach would you recommend ?
There's also Google Drive's "Application Data" folder.
https://developers.google.com/drive/android/appfolder
This has the advantage of using the user's storage space.
I would look into either Google App Engine or Amazon Web Services. They both give you free allotment of usage per month and if you go over then you start paying, chances are you wont get past the free tier for a while.
AWS is a bit more mature than GAE currently and seemed to be a bit easier to implement that GAE was when I was researching them
Take a look at the new training class for sync adapters:
http://developer.android.com/training/sync-adapters/index.html for the basics of sending data from your device to a server.
On the Android device, I suggest you store your tasks in a content provider. This helps you keep track of updates since the last time you synced. You can then query the provider during your sync, send only the data that's been updated, and store the data on the server.
You should probably store the last update time on the device, so you can tell if the server contains data that isn't yet on the device. Remember that you'll have to download tasks as well if you want all devices to be in sync.
You can try Google's Firebase. Firebase provides SDK for Android and iOS devices. And also, firebase supports offline and syncing. Firebase also provides object storage service. It easier to create firebase app than you think. Have look at this firebase's firestore service.
You can take a look at our Rethync framework (freeware with source) . Using it you can simplify the task of detecting modifications and sync only updated data. Next, Rethync provides both client- and server-side API so you can create your own service (and host it on the web side) or you can write your own transport for the cloud service of your choice (we will provide some transports in future, they are under development now).

Mobile Development and Cloud Database, Where Should I Start?

I am an Android Developer and a noob when it comes to web technologies.
I am planning to create an Android app that stores its data to a database.
I do not want to maintain my own server so I guess I would be resorting to Cloud Services.
The thing is I do not know where to start.
What do I need to be able to access and store data to a cloud database from my Android app?
Where can I get a cloud database preferably for free.
Do I need to use web services?
Any help
There are a few things in this that make me ask questions, as opposed to answer them.
Do you mean for your application to be always able to communicate with the database, or will it be more of a backup/sync with a database you have on your handheld.
If you do intended the app to be live all the time, then just write a web app and construct it with small screens in mind. It would be faster and sort of cross platform.
If you intend to have the app just sync with a back-end.. Well then a simple web service should do you for storage. Yep. Rails would be the way to go.
It really depends on your users.. How will they be using the app? Where will they be?
Personally I like the stand alone application that just sync's with the back-end. It is less prone to crashing because I walked into a tunnel. It also lets me control when and where I am when I sync. But it means the data I'm looking at could be out of date. And the data I'm adding isn't right there for others to consume.. they have to wait for me to sync'.
Check out Amazon's AWS and their SDK for Android. Highly recommended.
I assume that you know Java and my solution would be GWT/GAE ,since you asked for web application,GWT https://developers.google.com/web-toolkit/ would be perfect way and also you could use Google AppEngine Store as Cloud service and also you can integrate GWT with Phonegap to run it in Android.

Android application design using Amazon EC2 and SimpleDB

I'm currently developing my first Android application and still in the designing stage trying to come up with a solid model.
My application will use the GCal data from a users Google calendar and sync it up with one or more other users to determine common meeting times between all without the tedious back and forth of scheduling over email.
I vision this working by storing each user and their calendar data in a database that will be refreshed daily. When a query to determine the optimal meeting times between a group is issued, I want to select the calendar data of each user from the database, perform the computation to find optimal times, and display the results back to the user who made the query.
The AWS SDK for Android supports Amazon SimpleDB and S3, in which case I would use SimpleDB for my database. Where I am getting lost is using the Amazon EC2 web service in concert with the SimpleDB to perform the computation.
First off, any feedback on my approach and/or design is appreciated.
Second, how does using non-Android, but Java based APIs/SDKs effect applications, or is it even possible to do so?
The API typica for Java looks interesting and useful if it is possible to use with Android for instance.
Thanks!
So, I think its important to note a couple of things.
What you are describing is not an 'android application'. Its a web service application with an android client. The reason I'm being pedantic is that many of the design decisions you need to make are completely besides the fact that your primary client will run on android.
I'm concerned about the viability of storing the users calendar in a non-relation database. I don't know if you've already looked through this, but the problem you are trying to solve (calendaring) seems like it would benefit from the relational benefits of a relational database. For instance, i'm not sure how you would structure for storage the data of past, present and future events/meetings in a non-relational. Its probably possible, but i'm not sure if its optimal. Depending on the amount of data you may also need to consider the maximum record size.
While its true that AWS SDK for android supports writing to S3 or SimpleDB, I think there is a lot to consider. The reason you are confused about the interaction with EC2 is that normally, your EC2 web service will be interacting with S3 or SimpleDB. By using the AWS SDK you can, in theory, remove the requirement for a web service. My main issue with that is that you're now forced to do lots more on each client because there is no common access pattern. Your ios client or web client needs to have all the same logic that your android client has to make sure its accessing your s3 and simple db data the same. If that doesn't make sense i can elaborate.
Using non-android api's and sdks is a mixed bag. Sometimes it works fine if the classes compile to Davlik. If they don't it doesn't work.
One thing I might point out, since you'll already possibly be tied to a Google technology is Google App Engine. The nice part about it is that there is a free level of service which lets you get your app up and running without cost. Based on the technologies you are suggesting, it might be something for you to look into. Other than that, my other strong suggestion is that you focus on building out the web service first and independently of the android client. Take the time to model what the client server interaction would be and move as much of the 'logic' to the server as is possible. Thats what I felt like was missing from your initial description. Where the crunching would be.
my solution is that you use O-O principles. store your db on amazon dynamoDB and then sync user data with the mobile app. then you do processing of the data/computation on the device before displaying the results

Categories

Resources