Guest Post by Darren Whanger, BikeReg creator
The Bike Index now can be accessed via an Android app!
Tyee Software has created a mobile app for phone and tablet usage named BikeReg, which allows for searching the Index via serial number, manufacturer, or general text searching. The application also gives users the ability to register new bikes on the Bike Index. The interface is a real time interface, which means that uploads of new bikes into the registry are available immediately.
A few BikeReg screenshots:
Another cool feature of the open Bike Index API is the ability to deliver data on stolen bikes for a particular locale. Here you can see the BikeReg app is able to combine this data together with Google Maps in order to display “Stolen bikes in my area”:
BikeReg makes use of the Bike Index’s open RESTful API (read the documentation) that delivers JSON, which makes integration of bike data into an application relatively straight forward.
AngularJS is a fantastic and sleek MVC framework for the application—it works great in a mobile app setting. If you ever have used other MVC frameworks, you will be right at home with AngularJS.
Ionic Framework is a cross-platform mobile app framework which provides for the native aspects of interfacing with either the Android or iOS platforms.
Sass is used to customize and manage the stylesheet customizations specific to the application–very cool tool.
JSON objects are both consumed and produced by the application and serve as the payload mechanism between the front end of BikeReg and the Bike Index back end. JSON is just a great and simple way to exchange data and is very efficient when working over low bandwidth data networks. Of course, it works fantastic when a device is connected via wifi as well.
Cordova plugins are native platform components which interface with hardware devices like cameras, bar-code scanners, file system, and geo-location, etc. Most Cordova plug-ins are specific to the platform so there will be no way around it, you will need to debug these parts of the application on the device itself.
The big thing with putting together a mobile application is how you debug it. Because the BikeReg application is pulling/pushing data from across the web, it is important for the application to gracefully handle varying connectivity situations. For simulating and debugging these scenarios, Google Chrome provides a great and powerful emulation tool which helps to speed development:
This tool allows for a variety of mobile devices to be emulated and their screen sizes to be tried out.
One important item when working with the Bike Index API or any API for that matter, is to start small. As in, get a simple portion of the API working, build the foundation, and then build out the rest of the API access from there—kind of like building a pyramid, layer upon layer. One of the things that is important when making a call to a RESTful API is making sure that the API call is asynchronous. Promises are perfect for this task:
Promises are JS objects where data will be deposited after a successful call, in this case, to a web API. The usage of Promises helps to keep the front end UI responsive and independent of the call being made across the web. Consumption of returned data via JSON.parse() provides a quick way to package up returned data into objects which can be iterated upon and easily consumable by other areas of the application. Passing objects around from the backend service layer to the controller where it can be actioned upon helps to insulate the application from specific backend detail and complexities.
BikeReg is a natural extension of Bike Index to the mobile platform and makes the Bike Index accessible from just about anywhere. The Bike Index RESTful API makes it considerably easier for a developer to build out an application. With these technologies and about 4-6 weeks you too can develop your mobile application or you can download BikeReg from the Google Play Store. BikeReg can be found by following the android link below.
BikeReg costs $1.99 - proceeds from the app go to Tyee software, NOT the Bike Index
Follow Darren at @darrenwhanger
This is a companion discussion topic for the original entry at https://bikeindex.org/news/bikereg-an-android-app-for-the-bike-index