Nike+ AS3 Library

Okay so I'm not the most athletic person in the world, but one thing that does get me out of the house is tracking how far I've been running. Watching the km's tick over!

But I'm sick of iTunes and having to log into nike online all the time. So I got bored this weekend and the result is the start of a new little as3 interface using the content from my Nike+ device. Initially this library just processes files that nike+ stores on the device, but would eventually like it to access the online service as well.

The NikePlus class represents the base of the Nike+ interface. With this interface you can load a series of workouts from their xml files and use the data stored therein for other applications.

The workouts are stored as xml files on the devices at a location similar to the below, (you may have to enable filesystem access in itunes to be able to see this):


Underneath this directory the data is setup as follows:

  • latest/*.xml - A series of xml workout files that haven't been synced
  • synched/*.xml - A series of xml workout files that have been synced
  • lastWorkout.xml - The last xml workout file
  • preferences.xml - Nike+ preferences xml file

You can get the library here:
svn co

Usage of the library is relatively simple at this stage:

  1. var _nikeplus:NikePlus = new NikePlus();
  2. _nikeplus.addEventListener( NikePlus.LOADED, nikeplus_loadedHandler );
  3. _nikeplus.loadWorkout( _workout_xml_location );

Then once loaded:

  1. function nikeplus_loadedHandler( _event:Event ):void
  2. {
  3. for each (var _workout:NikeWorkout in _nikeplus.workouts)
  4. {
  5. trace( _workout.summary.calories );
  6. trace( "Data Interval: "+_workout.intervalValue );
  7. for (var i:int = 0; i <; i++)
  8. {
  9. trace( "Data Point["+i+"] "[i] );
  10. }
  11. }
  12. }

Started building a simple little AIR application to eventually replace iTunes and Nike online. I'll post more when I have a working version.

Published by


Leave a Reply

Your email address will not be published. Required fields are marked *