SharedPreferences sync - android

I desire the application state synchronized across the various devices that Users own phone and tablet. I want a way to automatically, or by a button for example, synchronize Android application settings (int and strings saved on SharedPreferences) with a Google account or APIs or automatic sync (in Google account Settings) but i'm very confused..
I see App Engine, GCM and "cloudendpoints"
So..what is the best solution to automatically sync the Preferences? Any example or guide? I think that the solution is easy but hard to find!

The solution is not easy. AppEngine can handle the web server part easily in many ways. The Android side will be harder, most particularly making it automatic. Android probably stops preferences being changed arbitrarily by external data to avoid security vulnerabilities.
Approach the problem from the Android end by first updating your preferences with your own App, then try it from your own Service, and then add AppEngine client software to your service. You will discover what you need to know along the way.

Related

Android - Use admin policy to configure app preferences remotely on multiple devices

I am working on some corporate app for Android which will be installed on all the company owned devices.
We need the company admins to be able to configure some preferences in the app. preferrably remotely using policy or any other method without need to hardcode the preferences changes in the code and redeploy it on all devices all over again.
Do android API has such feature?
I've looked into the Device administration (which should be deprecated soon) but it doesn't seems to be what I am searching for.
I want to be able to remotly setup keys in the sharedPreferences just like a PreferenceActivity would do.
We could also build some private REST server to call it from the app in order to retrieve the preferences we want and programmatically setup them.. but I'll be happy to find simpler out-of-box feature to do that without the need to maintain a server.
Any Idea?
Thank you in advance

Best way to manage ios and android applications simultaneously

When I build a web application, like most others, I simply build an admin area from which the client can control their site.
Most applications I build for android never require this kind of maintenance as they are all self contained. However Something I'm extremely curious about, say you build a cross platform application that does require constant maintenance; you've got 2 versions - an iOS and android version. What would be the best way to go about managing both applications from the same place?
For examples sake, let's say you build a real simple application. It could be something that once a day sends you a message, "hope you're day is going well" or "let me tell you a joke". Now what if those messages were hand typed and submitted to the applications, you want to log into a system, type the daily message in and both applications are simultaneously updated with the new message.
In my head I'm imagining you would need to build a dedicated admin system either as a web application or standalone desktop application that connects to the apps hosted database however I'm wondering about how well that would work, what kind of problems are you going to run Into, would it even be feesable?
I've never had to build something like this but some of the more recent web applications I've built would work well as straight forward applications and that just gets me thinking, if I was asked to turn them into apps that function the way they do already, what would be the best way?
It's something I'm really curious about and feel like I need to get my understanding on the right track.
I think you are describing an application for an admin that will set up (write) data to be used by users of Android and IOS apps. Few options:
Write the admin application as a regular web application. Be careful to use transactions in the code that writes to the database. That is to avoid inconsistent DB states when your admin applications DB writes interleave between mobile app reads. Also you have to secure the admin REST resources (API end points) for admin access only, so you would need authorization code in the app.
Write admin apps for the mobile platforms (or an admin section in the existing app that is properly authorized in the app code) and the server API end points. That is more tedious because of 2 platforms. Again you will need the DB transactions and authorization code
Write separate admin apps for mobile but with one framework (Xamarin). It will work for simple apps and yours sounds simple enough for Xamarin to work well.

Online Storage Android App

I am to build an android app that needs a central cloud storage (along with some server coding). My app is somewhat in the footsteps of
https://play.google.com/store/apps/details?id=com.justyo
I mean i should be able to store a login and registration (possibly FB login in the future too). Then, i will also have to maintain and fetch users' 'friends' in the app along with a status (that can be changed any time by the friends).
I am not new with android dev. I also know ample amount of web development. However, i don't know the approach to this kind of an app that is to use some server side code and online db for android.
I have search a lot on the internet and have found a bunch of stuff, but i am just not getting the confidence as to which approach is what i need here.
Is there something pre-built and given by Google themselves?
Do i have to by a domain, deploy a hidden (UI-less) web service and access it through the android app?
is there a free option out there by google?
Is there a sample demonstration android app out there?
I don't need the code or anything. I am just confused; afraid of starting off in the wrong direction. Please answer so it is easy to understand.
Thank you in advance :)
There is the Google Cloud Platform, specifically App Engine. You can read the Docs here.
You dont't need to register a domain to use the platform. Yes, you will need to deploy a (not necessary UI-less) web service to the cloud, accessed from the Android client through endpoints. Additionally, the service is free up to certain limits.
Sample apps are available for deployment once you create a project from here.

Syncing SQLite table over devices

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.

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).

Categories

Resources