The best APIs and libraries for Android developers

Developing for the Android operating system has a high level of complexity, but over the last decade the number of applications, libraries and methods has greatly simplified the tasks. With over 2 billion devices using Android, it becomes imperative to have some kind of presence in this open source platform.
3 min reading
06 August 2018
The best APIs and libraries for Android developers
The best APIs and libraries for Android developers

BBVA API Market

Developing for the Android operating system has a high level of complexity, but over the last decade the number of applications, libraries and methods has greatly simplified the tasks. With over 2 billion devices using Android, it becomes imperative to have some kind of presence in this open source platform.

Developing for the Android operating system has a relatively high level of complexity, but over the last decade the number of applications, libraries and methods has greatly simplified the tasks. Let’s review some of the most interesting ideas that every developer should know about.

Cloud Storage API from CloudRail

The CloudStorage interface combines several common functions of several cloud storage systems. Through abstraction of methods and references to files and folders, it manages to greatly simplify integration with Dropbox, Google Drive, Microsoft OneDrive, Box and more.

Cloud Storage API has all the basic methods, like uploading files, downloading files, creating directories, copying, moving and deleting. But it can also deal with metadata and file thumbnails, and, of course, it can manage the entire process of user authentication.

A practical example to upload a file to a previously selected provider:

AssetManager gestor = getAssets();

InputStream stream = gestor.open(“archivo.txt”);

long size = gestor.openFd(“archivo.txt”).getLength();

cloudstorage.upload(“/directorio/archivo.txt”, stream, size, false);

Retrofit from Square

This is an elegant solution to organize calls to an external API created by Square. As they say on their own website: “Retrofit turns your REST API into a Java interface”. No sooner said than done: the system allows annotations and URLs for resources to be created with simple code.

A common example for finding users with a specific name:

public interface Plataforma {

@GET(“/usuarios”)

Call<List<Repo>> listRepos(@Path(“user”) String user);

}

And with this, create a simple implementation

Retrofit retrofit = new Retrofit.Builder().baseUrl(“https://api.plataforma.com/“).build();

Plataforma service = retrofit.create(Plataforma.class);

That can be executed synchronously or asynchronously, as easily as:

Call<List<Repo>> repos = service.listRepos(“nombre”);

GSON from Google

Retrofit, and so many others, use GSON, and so should you. GSON is a library created by Google that optimizes and facilitates converting Java objects into JSON and vice versa.

String usuarioJSON = new Gson().toJson(usuarioObjeto);

User usuarioObjeto = new Gson().fromJson(usuarioJSON, User.class);

EventBus from Green Robot

As your application grows, it will be important to maintain a simplified system of communication between services, threads, fragments and activities.

EventBus does just that by creating listeners in all elements: background services, activities, fragments, and helper classes. A similar library, from the creators of Retrofit, is Otto. Both allow events to be registered and subscribe to with scarcely any source code.

Android Pay from Google

A simple and fast native method for creating secure payments in your application’s payment infrastructure. This will allow your users to make payments in a consistent way.

Android Pay is not yet available worldwide, and works from some authorized payment processors, such as BBVA Compass, Stripe, Braintree and Simplify. Google offers an open source application to show a basic example that offers the full flow of an Android Pay implementation.

In-app Billing from Google Play

If what you want to do is sell digital products or process item purchases within your app, you have to use Google Play’s In-App Billing.

The API is complete and Google manages all the purchase details, so you do not have to process any type of financial data.  Users have a consistent and familiar interface that streamlines the process and helps decision making.

BBVA API Market

BBVA’s open API platform also offers many possibilities. The BBVA Customers API, for example, allows applications for Android and other systems to use an OAuth-based interface to handle information belonging to BBVA users and customers.

In addition to authentication, API Customers and Payments API allow quick payments to be generated simply. Obtaining information regarding the customer before making payments can help create a more efficient payment platform.

To request the information, just send a POST request with two specific HTTP headers:

Authorization: Basic YOURAPPCREDENTIALS

Content-Type: application/json

POST https://connect.bbva.com/token?granttype=authorizationcode&code=YOURCODE&redirect_uri=YOURREDIRECTURI

You can use Google’s GSON, mentioned above, to manage BBVA Customer data and BBVA Payment data in JSON.

Discover all the financial APIs BBVA offers you

It may interest you