Connecting Android apps with Java and #AzureML

During my mentoring session with Acorn Inspirations, we were building an app that needed to access AzureML via an Android phone app. Quickly, it became clear that we were integrating a lot of different moving parts: Android, Java, AzureML. How did we do it?

Without giving away too much about the solution they are building, I worked on the Azure Machine Learning part to produce a sample recommender model. The model was created by going through the TDSP process, and it was productionized and ready to go.

Meanwhile, the other team members worked on the Android app, and then we got to the point of knitting everything together.

Writing an Android app means that the code has to be in Java or Kotlin. Kotlin is more complex, and you can read this excellent book, Kotlin in Action, in order to understand it better.

There is also the matter of network calls on Android. One recommendation is that we could use Retrofit to sort out the network calls but this would take longer to implement since it is more complex, so it was decided to use the standard http packages that are available in the Android SDK instead.

Then came the question: how do we use the APIs? JavaScript with jquery is one option and it can be faster. Then we had a piece of luck.

Using this Azure sample here, it tuns out that the project, with the ability to connect to Azure, is built in. This is known as a QuickStart and this facility allows you to configure the client application, which is wrapped up as a complete Android project which you can open up in your IDE. Neat!

Once that’s done, it’s possible to think about configuring the Android app to connect to your AzureML model using Java. There is a good example here:  https://github.com/aribornstein/JavaAzureMLClient

For more information in making your model production-ready, see the Microsoft Azure ML documentation here. It’s also possible to retrain the Azure ML model and it’s worth considering, too.

So yes, there are a lot of moving parts but Azure does give you some help on the way.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s