Google Fit session

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
sashby
Posts: 2
Joined: 17 Aug 2016 17:04

Google Fit session

Post by sashby » 17 Aug 2016 21:06

Hello - I'm trying to start a Google Fit session automatically. I want to use an nfc tag to start "kayaking" activity.

I've been able to launch Fit using a shortcut, but I think I need to use an Intent to start the activity.

From Google API docs I found this, but I'm not sure how to use this in Automagic, and it seems like an Intent should be easier..? Thanks!


GoogleApiClient client = new GoogleApiClient.Builder(context)
.addApi(Fitness.SESSIONS_API)
...
.build();
client.connect();

Session session = new Session.Builder()
.setName(sessionName)
.setIdentifier(identifier)
.setDescription(description)
.setStartTimeMillis(startTime.getMillis(), TimeUnit.MILLISECONDS)
.build();

PendingResult<Status> pendingResult
= Fitness.SessionsApi.startSession(client, session);

sashby
Posts: 2
Joined: 17 Aug 2016 17:04

Re: Google Fit session

Post by sashby » 19 Aug 2016 22:57

http://automagic4android.com/flow.php?i ... a57fbed2ee

See attached flow above, showing my new approach to this. I'm getting the following error. Any help is much appreciated!

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=vnd.google.fitness.TRACK typ=vnd.google.fitness.activity/kayaking flg=0x10000000 (has extras) }

Post Reply