| Compra la bianca | Compra la nera | Compra entrambe |
Android developers wishing to integrate Withings Webservices into their applications can use our sample app source code. Its purpose is to show the usage of our external API. As you will see, the UI is very basic and it is only provided for demonstration purposes, you should create your own. It does not provide any method for permanent storage of user data, either. It includes device-side code for C2DM notifications, explained later.
For a fully functional Withings integration, you should take advantage of our push notification system for new measures. The approach we recommend for Android is based on Google Cloud to Device Messaging (C2DM) as well as and on our Webservices subscription systems. You will need to run some (little) code in a server of your own. We also provide some sample code (PHP) for that purpose. Please bear in mind that these sources are not complete, and thus do not work “out of the box”. You will most notably need to implement a registrar (registrar.php in the code) that stores Withings IDs from the users subscribed to the notification system and the corresponding C2DM Registration Id of their Android devices. To ease your understanding of all the system, we provide the following Figures depicting the most common scenarios:
Google C2DM Client Login
Withings user – Android device registration for C2DM notifications
Your callback url should include Withings User Id.
Notification procedure for new measurements.
Notifications info content is determined by your server (it can request info about the measure from
Withings WebServices through the external API)
Your server should verify if the device is registered and if it is not revoke the subscription from Withings WS.
Android device unregistration from C2DM notifications