Android Intent to start recording

3,240 views
Skip to first unread message

John Ash

unread,
Feb 11, 2014, 8:39:19 PM2/11/14
to strav...@googlegroups.com
Hello everyone,

I'm looking for a way to start Strava and immediately begin recording the ride. I'm looking for this so that I can use an app like Tasker to automatically record my ride when I get on my bike.

Is this something that someone with minimal android programming experience can set-up?

Thank you,

John

Mateo Ortega

unread,
Feb 11, 2014, 9:43:11 PM2/11/14
to strav...@googlegroups.com
Hey John,

In the current version of the Android App you can do it with NFC using the values below. If you can wait for the 4.0 version (or use the Early Access https://rink.hockeyapp.net/apps/4aa8962445455f3059222d2aea49c800) you can get to it right now with standard Intents from anywhere.

type="android.intent.action.RUN" 

Mateo

tfasz

unread,
Apr 11, 2014, 8:26:11 PM4/11/14
to strav...@googlegroups.com
Mateo - thanks for providing this info. It took me a bit but I was able to use it to get Tasker working to auto start Strava when I leave home on my daily bike commute (and when I leave work). 

In Tasker define a profile to trigger on exit of your location (I also specified a day and time filter). Then create a "Start Strava" task. The task has a action "Misc" > "Send Intent" defined as:
Action: android.intent.action.RUN
Target: Activity    (note this is not the default value - change it from the default Broadcast Receiver target)

Tested with Strava 4.0.1.

Jared Paty

unread,
May 4, 2014, 12:25:45 PM5/4/14
to strav...@googlegroups.com
With the 4.0 version out can you expand on what the standard intents are to control the recording of an activity?

Mateo Ortega

unread,
May 6, 2014, 8:08:52 PM5/6/14
to Jared Paty, strav...@googlegroups.com
Hey Jared,

There are three options that I hope are self explanatory. Unfortunately they are NFC prefixed, but that's how they first got into the app.

"http://strava.com/nfc/record"  //start, if already started no-op
"http://strava.com/nfc/record/stop"  //start, if not started no-op
"http://strava.com/nfc/record/toggle" //if recording, stop. if !recording, start

Easy enough to use, something like:
Intent intent = new Intent(Intent.ACTION_RUN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData("http://strava.com/nfc/record");
startActivity(intent);

Let me know how it works for you.

m



--
You received this message because you are subscribed to the Google Groups "Strava API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to strava-api+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Mateo A. Ortega

Dir. of R & dWearables

Clayton Craft

unread,
Jul 15, 2014, 5:14:53 PM7/15/14
to strav...@googlegroups.com, jare...@gmail.com
I just discovered this posting after filing a support ticket with Strava. I've implemented a 'task' using "http://strava.com/nfc/record/toggle" and, after about 3 months of use, have found that this does not always toggle as it should. It seems to work fine when Strava is not running in the background. When Strava is in the background (and not recording), this does nothing more than bring up the 'record' screen in Strava, but never toggles the record. 

Mateo Ortega

unread,
Jul 15, 2014, 5:17:25 PM7/15/14
to Clayton Craft, strav...@googlegroups.com, Jared Paty
Clayton,

Some changes were done with the Wear release of the Strava app for the Google fitness Intents. Just to clarify, what version of the app are you testing against?

M
Mateo A. Ortega

Dir. of R&D & Devices

Clayton Craft

unread,
Jul 15, 2014, 5:25:39 PM7/15/14
to Mateo Ortega, strav...@googlegroups.com, Jared Paty
Hi Mateo, 
I'm running 4.1.4, but have been experiencing this quirky-ness since 4.1. My previous comment "after 3 months of use" wasn't meant to indicate that this problem is new for me, just that I've tried to rule out the issue as a one-off thing (it seems to be somewhat repeatable), and it has taken me a while to get around to reporting :)

-Clayton

Mateo Ortega

unread,
Jul 15, 2014, 5:32:03 PM7/15/14
to Clayton Craft, strav...@googlegroups.com, Jared Paty
Understood. Just for further clarification, with 4.1.4 do you still see the problem? Hoping I am going to luck out if the refactoring in that version took care of it. 

Those Intents used to be tied to the recording activity but not anymore. As a matter of fact, if you'd prefer the intent catcher to not open any activities at a set a boolean extra called "show_activity". It defaults to true.

m

Mateo Ortega

unread,
Jul 15, 2014, 5:39:12 PM7/15/14
to Clayton Craft, strav...@googlegroups.com, Jared Paty
While I'm looking at it, one more option n 4.1.4 and beyond

For start a ride or run by including a String extra of "rideType" as "Run" or "Ride". Funny that is the name of the variable. Legacy variable values...sigh. 

m

Clayton Craft

unread,
Jul 15, 2014, 5:39:54 PM7/15/14
to Mateo Ortega, strav...@googlegroups.com, Jared Paty
Hi Mateo,
I still see the problem with 4.1.4, unfortunately.. saw it this morning when I was getting ready to ride to work, actually.. Good to know about the bool option! Is all of this (plus any other options) documented publicly someplace?

-Clayton

Mateo Ortega

unread,
Jul 15, 2014, 7:57:44 PM7/15/14
to Clayton Craft, strav...@googlegroups.com, Jared Paty
Doesn't this count as documentation??? How about a cross link from reddit/strava? :P In all seriousness, these aren't officially supported and subject to change, etc, etc, etzzzzz. Unlikely they will ever change or go away. 

There are no other options at this moment and time. That was just added as a side effect for Android Wear support. One last note, the shown activity will change depending on the recording starting or stopping. If starting, it'll show the record screen. For stopping it will show the "Me Feed" while it uploads.

I'll test out the toggle intent and see what's up. I ran through all those before Google I/O and they all worked.

Mateo

Clayton Craft

unread,
Jul 15, 2014, 8:01:05 PM7/15/14
to Mateo Ortega, strav...@googlegroups.com, Jared Paty
Haha, well, I suppose it does count as "documentation", albeit not in a very "user friendly" way since it's buried in this thread :)

I've added the rideType extra to see if that makes any difference and continue testing it (about to ride home for the day)

Thanks for your support and quick responses!

-Clayton

Glyn Hudson

unread,
Jul 25, 2014, 7:18:33 PM7/25/14
to strav...@googlegroups.com

HI guys, 

Just wondering if this API is still working? I've been trying to setup Android tasker to toggle recording a Strava ride using http://strava.com/nfc/record/toggle. The following seems to Start the strave app and load the record ride page but does not actually start the recording. Am I missing something or has the API changed? I read something above about the app changing to support Android wear. See screen grab of tasker setup:

Glyn Hudson

unread,
Jul 25, 2014, 7:37:05 PM7/25/14
to strav...@googlegroups.com
Sorry, just realised I need to setup tasker to send intent rather then launch app, this is found in tasks>system>Send Intenrt in Tasker then setup as tfasz described above.



On Wednesday, 12 February 2014 01:39:19 UTC, John Ash wrote:

Mark Ifi

unread,
Dec 5, 2014, 5:46:38 PM12/5/14
to strav...@googlegroups.com
rideType:Run as an extra string works! Thanks Mateo!

Chris Olin

unread,
Jan 27, 2015, 1:03:18 PM1/27/15
to strav...@googlegroups.com, jare...@gmail.com
I found this post several months ago and wanted to sum up my experience in using this API and how I've used it with Tasker over the last couple months.

1). In another post, Mateo (or someone else) mentioned another extra called "show_activity". By default, this extra is set to true. This is a problem when using the toggle intent. It will not work if the Strava activity is loaded in the background. You will want to make sure that you manually set this extra to false. The start intent doesn't suffer from this problem.

2). If "show_activity" is set to false when stopping a ride, the ride will not be uploaded automatically. It will upload the next time the Strava app is open (or you run one of these intents with the "show_activity" extra set to true).

3. This next comment is less about the API/Tasker as it is calling the task using voice commands. In Lollipop, a change in how permissions work currently prevent Tasker and Utter from being installed at the same time. In KitKat, I had a custom command set up in Utter that called the related Tasker task. To get this functionality back in Lollipop, I use AutoVoice, which allows me to create custom commands in Google Now.

I've attached some screenshots to help visualize my setup. I should mention for Mateo's benefit that this API is the sole reason that I use Strava over Endomondo. With bluetooth headphones (http://www.amazon.com/dp/B00PEPIWNI) and an app to remap bluetooth buttons (https://play.google.com/store/apps/details?id=com.yado.btbut), tracking a ride with Strava is easy. Compared to pulling your phone out, unlocking it, getting the app open and starting the ride, then hitting the power button on the phone, and putting the phone back in your pocket before you can start biking.


On Tuesday, May 6, 2014 at 8:08:52 PM UTC-4, Mateo Ortega wrote:
Hey Jared,

There are three options that I hope are self explanatory. Unfortunately they are NFC prefixed, but that's how they first got into the app.

"http://strava.com/nfc/record"  //start, if already started no-op
"http://strava.com/nfc/record/stop"  //stop, if not started no-op
2015_01_27_12.44.05[1].png
2015_01_27_12.44.18[1].png
2015_01_27_12.44.31[1].png
2015_01_27_12.51.58[1].png

Anderson Imes

unread,
Aug 4, 2015, 12:13:36 PM8/4/15
to Strava API
Has anyone figured out how to pause a ride rather than stop it? If like my lunch rides to be contiguous and just pause when I walk into the restaurant. Right now they are broken into two rides.

Anderson Imes

unread,
Aug 15, 2015, 11:57:02 PM8/15/15
to Strava API
Since an update to Strava on Aug 11, this doesn't seem to work anymore. The app launches but doesn't start a ride. Anyone else?

Mike

unread,
Sep 4, 2015, 2:47:37 PM9/4/15
to Strava API
This app still works. Can probably use a tasker or trigger to start this app. 

Anderson Imes

unread,
Sep 4, 2015, 4:27:42 PM9/4/15
to Strava API
It's odd. The behavior is intermittent. Sometimes it works. Sometimes it brings the app to the foreground. I don't see any real common attributes to this behavior but I can reproduce it easily. A strava engineer would be really useful here. I really like the functionality of automatically starting rides, but I need it to be reliable or it's useless.

Darren Newman

unread,
Sep 4, 2015, 4:33:20 PM9/4/15
to Strava API
I always found if Strava was already running (even in background) when starting a ride with intent it was very unreliable and normaly failed. I use tasker to kill Strava wait a couple of seconds and then then the start intent and it works everytime.

Anderson Imes

unread,
Sep 4, 2015, 6:49:09 PM9/4/15
to Strava API
I tested that theory. Restarting my phone seems to solve it a lot of times, but killing the process doesn't seem to consistently help.

Brendan Brisker

unread,
Oct 16, 2015, 7:11:36 PM10/16/15
to Strava API
Thanks for this discussion--- I have this working very reliably now.

Anderson, like you I found the simple Kill or Kill and Wait approach before the Intent to be unreliable.  I now have my Tasker Start Strava routine starting the Strava app, then killing it, then sending the Intent.  So far it's working every time.  LG G3 Verizon, Android 5.11

Andrew Roberts

unread,
Dec 15, 2016, 8:20:09 AM12/15/16
to Strava API
Hello, 

Does anyone know of any other NFC/Intents that can be used with strava? 

The automate app http://llamalab.com/automate/community/flows/484 provides an example for examples of starting and stopping a running or biking activity in the Strava Running and Cycling app.

I use 2 bikes and would like the NFC tag to change the gear selected in the app. I'd also be interested in any other options.

Thanks

Andy


On Wednesday, 12 February 2014 01:39:19 UTC, John Ash wrote:

Roger Venning

unread,
Aug 5, 2017, 7:39:57 AM8/5/17
to Strava API
I'd also like to know - particularly with regard to triggering sending a beacon - either triggering Strava to itself create the further intent; or returning the beacon URL so as to be able to manage that directly.

Thanks in advance,

Roger.

Mark Ifi

unread,
Dec 31, 2020, 11:00:02 AM12/31/20
to Strava API
this no longer works as also stated by another user here:

percieved exertion query prevents the above intents from starting or ending a recording
Reply all
Reply to author
Forward
0 new messages