Google fit steps in an android service - android

How do I get the amount of steps the user has taken outside of an android application? Preferably using the google fit api to get the steps.
All i know is that the steps would have to be fetched in a Service or a BroadcastReceiver, but i don't know how. Does anyone know of some documentation or code that could help?
If you know a way to accomplish this without google fit that would work to.

I don't think you can take out Android apps out of the equation because Google Fit API is part of Goolge Play Services which is found on Android devices. So to work with Google Fit, you need to develop apps for Android phones. This is found in the Get Started guide of the Google Fit API.
To know about counting steps, check this documentation and a related SO post Android 4.4 Step Detector and Counter talking about counting steps using sensor of the android device (w/o Google Fit).

Related

How to use Google Fit API on Wearables (Sony Smartwatch)

I`ve been trying to use the Google Fit API for counting steps in my App for the Sony Smartwatch 3. I can't find any basic step-by-step tutorial for using the API.
So my question: does somebody know any tutorials or similar where I can look up how to use it?
I think this documentation of Google Fit can give you the basic or the first step that you need to do in order to connect the Google Fit API in to a Wearable Device.
For the different API from Google FIT, this page of the documentation can give you a sample code on how to use the following APIs:
AndroidWatchFace
BasicSensorsApi
BasicRecordingApi
BasicHistoryApi
BasicHistorySessions
For more information, check this SO question and these tutorials:
How To Develop Your First Google Fit App.
How To: Use GoogleFit API

Unity Social API

We are writing an application in Unity3D for both iOS and Android and we'd like to use the provided Social API to retrive and post the highScores on iOS (using GameCenter) and Android (using Google Play Game Services).
To keep the application simple, its weight low and to avoid cross-compilation extra setups we'd prefer not to use external plugins (unless point 4 is true).
I googled around for documentation and tutorials and I found THIS ONE.
The implementation has been done in C#, but since the Unity guide also provides a c# version it went all straight forward.
However we couldn't manage to get this work, probably also because we don't understand well how this API really work.
First of all: the Unity guide states that "It [the api] provides a unified interface to different social back-ends, such as XBox Live or GameCenter", but in the implementation is not specified which social back-end is being used. How unity knows that? It switches depending on the platform?
Second: I understood in various guides that the GUI provided to show the leaderboard is directly provided by the host platform and from the console log i get these following success messages:
Authenticated, checking achievements
Error: no achievements found
Successfully reported achievement progress
but running the application in the editor, in a build made for windows or an apk used in BlueStacks, i get the same message when I call the function Social.ShowLeaderboardUI(); which is
ShowLeaderboardUI not implemented
I could expect it from the editor and the exe, but BlueStack emulates Android and i would be surprised if it doesn't provide the google play services. However i also read about a "sandbox mode" which is the one that should run in the editor and this leads to point three:
I can't find a way to set this sandbox mode, at least not from that guide.
Fourth point: Unity has a GameCenter class, but no classes for the Google Play Games Services, so: I can do what I want with iOS but I need an external plugin which implements the ISocial interface for Android?
Fifth point: How do i handle authentication in both sandbox and deploy mode?
As you can see I'm surely missing something on the coding side, conceptual side or both. Can you provide a step-by-step procedure on how to achieve what i need? I don't need to get pieces of source code, but if someone can explain me well how this API works it would be great.
Thanks in advance
For Android:
To integrate Google Play Service into Unity, you need to use a plugin. You can find the Google supported plugin here. You can find information on how leaderboards work here. Essentially how it works is:
You create the leaderboard in the Google Play Developer Console
You submit scores to the leaderboard created (at whenever you determin is the appropriate time)
Google Play Services sends a response back telling if it's a high score or not.
I suggest you take a look at the Cubic Pilot_4.6 sample as that demonstrates how to implement leaderboards. Also, you really ought to test this on a physical device, due to how emulators may have trouble handling Google Play Services and account logins.
As far as authentication goes, Google Play Services takes care of most of it for you. You can probably see more in the samples (Social.localUser.Authenticate).
Current implementation does only provide implementation for GameCenter and XboxLive. There's a property Social.Active which can be used to modify what social platform is used. You can set a object which implements ISocialPlatform but im not sure if that interface is fully open - thus, im not sure if anyone can implement that..

How to Make LBS applications in Android

Anyone has a tutorial of making LBS applications like this? I want to make an application to determine the trajectory of the city's public transport me, but I did not find his examples everywhere, if you have please help me to develop it, thank you
It is a concept design of my application layout
To develop an android app which uses Google API's would be a combination of Google Maps API, Location Api, Direction API and also Places API(if you want to fetch the details of your source and destination). If you are developing this app for a special transit system in your city than you would specifically need their own set of API to populate your app data.
But if you want to develop something with free open source Google API you can first make use of the Google Play Services by first referring into your app project and then getting the API key, enabling the direction api "ON" in your developer console and writing code.
Please refer to this tutorial in order to get a better insight of the transit system app you want to develop. You can customize you app UI accordingly once you have the data coming in.
Here are the bunch of links from Google's official documentation regarding implementation of all API's.
https://developers.google.com/maps/documentation/android/
https://developers.google.com/maps/documentation/directions/
https://developers.google.com/places/documentation/
Hope this would help!!

Google maps containsLocation on android

I'm writing an app that needs to determine whether a user falls within one of several defined zones (based on gps location).
The Google maps javascript API has an easy to use function containsLocation(). However I want to be able to do this from an app on android, not a web-based service. Does anyone know if such a call exists in the android version of maps? Any pointers will be helpful!
A bit late, but here's the answer: com.google.maps.android.PolyUtil.containsLocation() from Google Maps Android API utility library.
You can use the Geofencing feature for this purpose. The API's for that are a part of Google Play Services library and hence you can start using it by importing it into your app project.
It even gives the notification if a particular user has entered or exited a specific geofencing location in order for a developer to monitor the number of mobile devices entered in the zone he defined. The implementation is pretty simple, I am pasting some links that may guide you further.
This is Google's official documentation about Geofencing:
http://developer.android.com/training/location/geofencing.html
This link actually implements an app for geofencing.
And this is another link if you want to use a third party plugin in order to get geofencing in your app.
Hope this would help!!!

Google Maps Coordinate android

I want to use google map coordinate in my android application.
http://www.google.com/intl/en/enterprise/mapsearth/products/coordinate.html?utm_source=google&utm_medium=cpc&utm_campaign=NA-LCS-2013-Geo-Products-MapsCoordinate-HouseAds&utm_term=%2Bgoogle%20%2Bcoordinate&utm_content=SearchAd&gclid=COy759vU2LsCFVMdtAodNGYAdg
I found this example on google play: https://play.google.com/store/apps/details?id=com.google.android.apps.geo.enterprise.flak
I searched on internet but didn't find documentation about how to implement google coordinate in my anndoid app.
Did any one used this before? If yes can you please put links of tutorial or links of samples?
Try this link, to the Google Maps Coordinate API Client Library for Java.
Otherwise, if you want to start from scratch, it's a RESTful api. There are a number of clients and libraries that you could use, including Volley. Also, here is a tutorial for making remote calls.
You can find everything you need here.
I have done it following this official tutorial recently. The version 2 of Google Maps Android API is different from version 1 in many points.

Categories

Resources