-
Note on Android DNS on a LAN
03/15/2014 at 04:10 • 0 commentsI ran into an interesting problem while trying to make the Android app talk to the server. Specifically, it couldn't find the host "edi". After much debugging, I finally came across an interesting fact: Android can't resolve machine names as IP addresses on the local network in the same way that windows can. There are a couple solutions for this:
1: You can get a router that supports enterprise grade DNS (or just one which can handle Tomato/OpenWRT). My router did not have either of these features.
2: You can set the server to use a static IP on the local network, and configure the Android app appropriately. This was the option I took.
It's not an ideal solution, but it resolved the communication problems, so I call it a win.
-
FitBit API Part 1: Getting the data
03/15/2014 at 03:45 • 0 commentsFitBit wouldn't let me use their API officially without a significant amount more effort than I was willing to put into this project (They wanted a website, among other things. Psh.), so I loaded up my trusty Fiddler and opened a session to their site. The dashboard program gets data with two basic calls:
A post to http://www.fitbit.com/login with my account credentials
A post to https://www.fitbit.com/ajaxapi with any API calls I want to make (using the cookies from the first session)
The ajax API just takes in JSON strings as input and returns the requested JSON as output. With a little experimentation, I found the format to be the following:
The request I was interested in (sleep data) is a URL-encoded JSON string with the following structure
request={"template":"/mgmt/ajaxTemplate.jsp","serviceCalls":[{"name":"activityTileData","args":{"dateFrom":"2014-03-13","dateTo":"2014-03-13"},"method":"getSleepTileData"}]}
Part 2 will cover converting the data to a usable dashboard.