The API lifecycle: A look at planning to production
A comprehensive collection of articles, videos and more, hand-picked by our editors
The standard package communication format is JSON packets sent through RESTful services. There are other ways to...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
send data such as SOAP, OData and XML, but JSON is the default standard. A JSON API can be easily consumed by Web, iOS, Windows and Android projects.
In this article, you will learn how to connect to JSON APIs in an Android project, which frameworks to use and how to connect to specific API frameworks Google has developed to make it easier to be an Android developer.
Connecting to JSON APIs
The good news is that Google has implemented JSON support directly into Android. This is accomplished with the android.util.JsonReader Object. Google provides a complete example of how the framework works.
The bottom line is that JSON applies to the following two methods:
- Array handling methods: beginArray(), endArray(), hasNext()
- Object handling methods: beginObject(), endObject(), hasNext()
The goal is to load a JSON packet, examine the contents of the object and then do something with the data.
JSON frameworks to use with Android projects
There are a large number of frameworks that make it easier work with JSON APIs. Here are some good examples:
- RestLet: build, test and run APIs for projects.
- Spring for Android: quickly add APIs built with Spring framework.
- Volley Framework: an easy to implement framework for JSON.
- GSon: make it easy to add rich JSON functionality.
- Jackson: another lightweight, fast JSON framework.
Experiment with these frameworks to see which works best for you and your team.
Additional frameworks Google supplies for Android
Google wants to make it easier to create solutions for developers. To do this, they have developed a series of APIs that support this goal. These APIs fall into three categories: develop, engage and earn. Here are specific APIs that teams should use:
- Analytics: track everything about how users interact with an app.
- Maps: arguably the most successful API of all time gives developers the opportunity to add Google Maps to any Android project.
- Google Cloud Message: send push notifications to any Android device.
- AdMob: monetize any Android app.
You can find more information about these APIs on the Google Developers site.
Now learn how to integrate JSON with iOS
Discover some REST alternatives for real-time applications
How Microsoft plans to win over Android developers
Related Q&A from Matthew David
Developers who use Xcode 8 have been faced with a choice: Make the jump to Swift 3.0 or simply upgrade to Swift 2.3. Here's what developers should ...continue reading
Apple now supports two developmental languages. This means integrating JSON with iOS isn't as difficult as it might seem. Expert Matthew David ...continue reading
Microservices can offer flexibility for developers, but should they be using it for mobile development? Matthew David offers his take.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.