Installing the Android libraries
To work with MobileFirst Quality Assurance, you must install the MobileFirst Quality Assurance SDK for Android into your mobile app. You can configure the SDK for either preproduction or production mode.
Before you begin
Important: Ensure that you download the correct SDK for your Android
IDE, either Android Studio or Android Development Tools (ADT).
Procedure
- In your Android IDE, add MobileFirst Quality Assurance to your project.
- For Android Studio, complete these steps:
- Add MobileFirst Quality Assurance to
your Android Studio project:
- In Android Studio, click File > New > New Module.
- In the Create New Module wizard, under More Modules, select Import .JAR or .AAR Package, and then click Next.
- In the File name field, enter the name
of the MobileFirst Quality Assurance SDK .aar file
that you downloaded. Tip: To browse to the file, click ....
- Click Finish.
- Add MobileFirst Quality Assurance to
your mobile app in your Android Studio project:
- Click File > Project Structure.
- In the Project Structure window, select the module for your app, and then click the Dependencies tab.
- Click +, and then click Module Dependency.
- In the Choose Modules window, select the MobileFirst Quality Assurance Android module that you imported, and then click OK. The Choose Modules window closes.
- Click OK to close the Project Structure window.
- Add MobileFirst Quality Assurance to
your Android Studio project:
- For ADT, complete these steps:
- After you download the MobileFirst Quality Assurance SDK for Android, extract the contents of the compressed file.
- To import the extracted version of the MobileFirst Quality Assurance SDK into Eclipse as a new project, click File > Import. Choose to import Existing Android Code Into Workspace, and then browse to the MobileFirst Quality Assurance SDK folder that you just extracted.
- To add the SDK to the project properties for your app, select your app in the Package Explorer and then click File > Properties to open the Properties dialog box.
- From the left menu, select Android, and then click Add under Library. Choose the library that corresponds to the MobileFirst Quality Assurance SDK that you recently imported.
- For Android Studio, complete these steps:
- Modify the manifest file: Tip: The manifest file that is included with the SDK contains all of the activities and permissions for MobileFirst Quality Assurance. The optional permissions are commented out; to enable them, remove the <-- and --> tags that surround each permission.
- Declare the MobileFirst Quality Assurance preproduction
activities. Ensure that the manifest file includes an <application> entry
that contains the following activities:
<activity android:name="com.ibm.mqa.ui.ProblemActivity" /> <activity android:name="com.ibm.mqa.ui.FeedbackActivity" /> <activity android:name="com.ibm.mqa.ui.ScreenshotEditorActivity" /> - Ensure that the following permissions are listed in
the manifest file:
- INTERNET
- MobileFirst Quality Assurance uses
this permission to connect with the IBM MobileFirst Quality
Assurance server.The following code snippet shows the INTERNET permission entry that you need to include:
<uses-permission android:name="android.permission.INTERNET" /> - READ_EXTERNAL_STORAGE
- Note: This permission is required beginning with Android 5.0.MobileFirst Quality Assurance uses this permission to allow IBM MobileFirst Quality Assurance to access gallery pictures that are on the external storage of the device.The following code snippet shows the READ_EXTERNAL_STORAGE permission entry that you need to include:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> - SYSTEM_ALERT_WINDOW
- Note: This permission is required as of Android 5.1.MobileFirst Quality Assurance requires this permission to open windows on top of your application, such as the MobileFirst Quality Assurance app tester log-in window in pre-production mode, the MobileFirst Quality Assurance bug and feedback reporting window in pre-production mode, and the MobileFirst Quality Assurance feedback window in production mode.The following code snippet shows the SYSTEM_ALERT_WINDOW permission entry that you must include:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />Important: If you do not add the permission, the app may fail with an InvalidDisplayException error:- In preproduction mode, the app might fail to start.
- In production mode, if the app uses the MQA.feedback() API, then the app might crash when the API is called.
- Add optional permissions. To access and monitor
device conditions, some additional permissions are required. You can
include or exclude these permissions, depending on your application.
- The following code snippet shows permissions that allow MobileFirst Quality Assurance to obtain detailed
information about connectivity services that are present on the device.
This information can include supported network interfaces, the type
of network connection in use (WiFi or 3G), WiFi information such as
signal strength, and more.
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - The following code snippet shows permissions that allow MobileFirst Quality Assurance to receive additional
information about the device.
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> - The following code snippet shows permissions that allow MobileFirst Quality Assurance to report locations
that are based on both coarse references (the nearest mobile network
tower) and precise references (such as GPS).
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> - The following code snippet shows permissions that allow MobileFirst Quality Assurance to report information
about the device's Bluetooth interface, including its state (on or
off) and pair-unpair events.
<uses-permission android:name="android.permission.BLUETOOTH" />
- The following code snippet shows permissions that allow MobileFirst Quality Assurance to obtain detailed
information about connectivity services that are present on the device.
This information can include supported network interfaces, the type
of network connection in use (WiFi or 3G), WiFi information such as
signal strength, and more.
The following code snippet shows an example of the content of your AndroidManifest.xml file:<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.applause.android" android:versionCode="6" android:versionName="2.3" > <uses-sdk android:minSdkVersion="8" /> <!-- Required permission --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- Optional permissions --> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <!-- ... rest of your application's permissions, if any --> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" android:name=".MyApplication' > <!-- ... rest of your application's components --> <!-- Quality assurance application activities --> <activity android:name="com.ibm.mqa.ui.ProblemActivity" /> <activity android:name="com.ibm.mqa.ui.FeedbackActivity" /> <activity android:name="com.ibm.mqa.ui.ScreenshotEditorActivity" /> </application> </manifest> - Declare the MobileFirst Quality Assurance preproduction
activities. Ensure that the manifest file includes an <application> entry
that contains the following activities:
- Configure a new session with each log in by completing the procedure in Starting an Android session.
Parent topic: Installing the Android libraries
Related information: