Android Quick Start demonstration
improve this page | report issueThe purpose of this demonstration is to make you experience an end-to-end flow where IBM MobileFirst Platform Foundation SDK for Android is integrated into an Android project and used to retrieve data by using a MobileFirst adapter.
To learn more about creating projects and applications, using adapters and lots more, visit the Native Android Development landing page.
Prerequisite: Make sure that you have installed the following software:
- MobileFirst Platform command line tool (download)
- Android Studio
-
Create a MobileFirst back-end project and adapter.
-
Create a back-end project in a location of your choice.
-
Add an HTTP adapter to the project.
-
-
Deploy artifacts to the MobileFirst Server.
-
Start the MobileFirst Server and deploy the adapter.
-
-
Create an Android project in Android Studio.
-
Add the MobileFirst Android SDK to the Android Studio project
- In Project > Gradle scripts, select build.gradle (Module: app).
- After
apply plugin: 'com.android.application'
, add the following line:
- Inside
android
, add the following lines:
- Inside
dependencies
, add the following lines:
- Add the following permissions to the
AndroidManifest.xml
file:
- Add the MobileFirst UI activity:
- In Terminal, navigate to the root of the Android Studio project and add the required configuration files by running this command:
-
Implement MobileFirst adapter invocation.
-
Main
Activity
classMake sure that your MainActivity class extends the
Activity
class:
Add the followingimport
statements:
Add the following lines to the
onCreate
method:
-
MyInvokeListener
classAdd a new
MyInvokeListener
class.
Add the followingimport
statements:
Paste the following lines:
-
-
Final configurations
- Create an Android Virtual Device (AVD).
-
Click Run.
Review the LogCat view for the data retrieved by the adapter request.
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.