How to do it...

Create a new project in Android Studio which can be named EmbeddedApp, and perform the following steps (when creating the application, make sure to automatically create an empty activity named MainActivity). The complete source code for this recipe can be download at https://github.com/PacktPublishing/OAuth-2.0-Cookbook/tree/master/Chapter07/EmbeddedApp.

  1. As we need to interact with an API through HTTP requests, let's add retrofit2 as a dependency for our project. To add retrofit2 to our project, open the application build.gradle file and add the following content within the dependencies declaration:
compile 'com.squareup.retrofit2:retrofit:2.3.0'compile 'com.squareup.retrofit2:converter-jackson:2.3.0'compile 'com.squareup.okhttp3:logging-interceptor:3.9.0' ...

Get OAuth 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.