Google Fit Custom Data Type - android

I am creating one Google Fit compatible App. My objective is to store Google Fit data using HistoryApi, and provide kind of Back Up- Restore functionality to user. If user buys new Android devices then he/she should be able to BackUp(sync) old data using his/her account.
I need to use Custom Data Type, as Public Data Types doesn't meet my requirements.
Everything works perfect, I am able to insert data and read data using History Api.
But When I try to read data from Another Android device using same Google Account then data is not available to read there.
My problem seems similar to this Custom DataTypes not synching between devices
This statement from Google Fit Document is not clear to me.
Custom data types are not available to use in other apps. Only the app
that creates a custom fitness data type can use it
source : CustomDataType
Q-1) What does it really means ? If I have an app GoogleFitDemo installed on multiple Android devices, then is it possible to sync data between this same app between multiple Android devices ?
Q-2)Is it improper way to store and backup data using Google fit ?
Update:
Finally, I found that Custom Data Type can also be synced normally, same as other Public Data Types. I had the sync issue as mentioned by #Ifor. Sync functionality is still buggy. In some scenarios sync stops working, and sometimes synced data is inconsistent across multiple devices.

1). My understanding is that same app same account but different devices it should work. Having said that sync is notoriously slow (hours days...) and has been buggy so it may be hard to tell if you have it right or not.
2) There are better backup methods... But if the data fits in with the rest of the stuff Google Fit is about and is not too big then it's probably ok.

Related

updateData() vs insertData() in Google Fit

I'm building an Android app which syncs data to Google Fit and uses the Google Fit SDK to achieve that - but I'm pretty sure my question also applies when you are using the REST API.
Within my app users can also change data inserted to Google Fit. The Google Fit SDK has two distinct functions to handle those kind of things: insertData() and updateData().
Now, I don't want to keep track of whether a user changed an already synced data point vs whether it is an entirely new datapoint. I just want to have a simple Boolean flag which indicates whether a data point has already been uploaded to Google Fit or not - that's to keep things simple and reliable on the app's side.
So when a user creates a new data point in my app, I set a syncedToGoogleFit flag for that data point in my DB to 0. When the data point has been synced to Google Fit I set it to 1. When the user later changes the data point in my app I set it to 0 again and so on.
However, the Google Fit SDK distinguishes between inserting and updating which means a simple Boolean wouldn't be enough to track changes on my end as insertData() will fail if there already is a data point for a given timestamp. Is it possible to always call updateData() even if I am actually inserting new data and that way get by with just the Boolean flag on my end?
Looking at the documentation it should be okay, but I would feel safer if someone could confirm that. Also I'd like to know whether there are any potential performance implications of the approach outlined above, but I guess this is just something the SDK devs can answer.
I've played around quite a bit with the SDK now and from what I am seeing I can say, that using updateData() seems to work just fine.

Data storage option that best suits for my android app purpose

I am creating an android app that can be used by common users and also admin.
Suppose, if admin adds a new place name, that name should be added to database and when common user uses the app, he should be able to see the place name that is added.
I used MySqlLite database. But the problem is that if the app is uninstalled all data is lost. So I want some persistent data storage in which all the places that are added by admin are saved permanently.
Regards,
Sindhu
With the data being needed across multiple devices, your only option is to create/use a backend API.
Parse would have been a good choice but since that is getting shut down soon then it wouldn't be wise to use that.
Take a look at these alternatives here
You could also write one yourself, but unless you have some experience in that sort of thing then it will take some time to learn.

Can we use parse to create two different kind of users with two different functionality.

We have developed an android app where the user can select few apparels and request for delivery (Cash on Delivery). Till now we were syncing the apparels from our web app. Now we want to transform the android app to an independent entity. Can we use parse to create two different kind of users
where the user can only browse product and order
where the merchant can upload products and their details.
Can we get the approach for doing this. We are using Android Studio for development.
I think I understand your question, and you can do that.
There are some ways to get that. On parse, when you create the user entity (by default), you will get "role" entity, that allow you create roles for your users.
Another way, (I'm currently using this for one project), is set to user entity a property like isAdmin or something like that as a boolean and then, you will check that to show the correct layout.
I hope this help you.

Put some values on internet to access from android

In my app a user can (only) see the values uploaded by admin.
For example. A salesman is using the app will be able to see the latest rate provided by the manger to trade.
Now the question is "where to put these values?"
I have .net webservice experience with android but I guess it wont work in this scenario,will it?
Any suggestion that the returned result be in (preferably) XML format.
It sounds like you already know how to do this. You can download and parse xml within your app. If you alreayd know how to set up the websever, the rest is easy. Limiting who can see what is just a matter of associating specific transactions with an individuals account. Then just have the phone check for updates on that transaction when the app loads (using someting like AsyncTask) or if you want to get more complicated you could push notificatinos using the android cloud service, or even use a REST model. More details are needed for a more specific answer but you can do what you want.
You can do it on your own, and build a webserver with a MySQL/PHP JSON API or you can use parse.com for a smaller project.

Android - fill app with data frequently

I have to create an app which shows a list of categories with products attached to each category.
The owner of the app uses this to inform customers about his products so there will be updates to the products every week.
Now I'm struggling how to create this app because there are a lot of options to do this, but I want to do it right of course.
So I was thinking about doing the following.
1. Creating a simple webapplication where the owner can manage his products and add/edit/delete them the way he wishes.
When changes have been made he can push a button "publish" which creates an xml file.
2. When the app is started and there is an internet connection, the latest xml will be downloaded into the device and the app will list the categories, products from the xml.
THe xml will be stored so that there are data to read when no internet connection is available.
Is this a good workaround? Or would maybe creating a webservice be a better idea?
But then the user should always be connected to the internet.
Some good advise would be welcome :)
A internet connection should be available at any time, and if not it should not be the problem for you to cover.
But if you want to catch that case, you'll need (or could use) XML to persist the latest data to the device, in case your app has to start up without internet connection.
I would think about a RESTful WebService, since you can add features with ease once you have it runnuing (that could get tricky of course). Here is a tutorial you could use: http://www.vogella.com/articles/REST/article.html

Categories

Resources