12 Install and Configure APM on Mobile Clients
iOS: Requirements and Installation Instructions
You can deploy Application Performance Monitoring on a mobile device running on iOS.
-
XCode version 8.1 and above
-
iOS – v 9 and above
-
Generate a Registration Key, if you do not have one already. See Manage Registration Keys in Installing and Managing Oracle Management Cloud Agents.
For Linux, the key is
${REG_KEY}
, and for Windows,%REG_KEY%
. -
Register your Mobile Client App and obtain a Mobile Client App Id:
-
In the left pane of the Oracle Management Cloud home page, select Administration.
-
Click APM Admin menu and select Mobile Client Registrations.
-
Register iOS mobile client on Application Performance Monitoring:
-
Click Register Mobile Client.
-
Provide the registration details — name of the application, mobile client platform (iOS), and the registration key. You can reuse the registration key generated in the Agent Download page.
Note:
The name of the mobile application you provide here must be the same as your target iOS mobile app. -
Click Register.
${MOBILE_CLIENT_APP_ID}.
-
-
Click OK.
-
-
Download the APM Mobile iOS Agent Installer. See Downloading the APM Agent Software. Ensure that the downloaded installer ZIP file is accessible from a Linux or Darwin (MacOS) shell window, or a Windows
cmd
window. -
Extract the ZIP to a local work directory like
/scratch/work
.$ unzip <apm ios installer>.zip -d /scratch/work
Verify that the extracted content contains the following:-
agent_software_build.xml
-
ApmAgent-<version>.zip
-
ProvisionApmiOSAgent.sh
-
AgentConfig.info
-
certificates/
-
certificates/emaas.cer
-
hybrid/
-
-
Run
ProvisionApmiOSAgent.sh
to extractApmAgent-<ver>.zip
and to configure theApmMobileAgent.properties
file:$ sh ./ProvisionApmiOSAgent.sh -a ${MOBILE_CLIENT_APP_ID}
-
Verify that the following new files get created in the directory where you ran the above step:
-
APMMobileAgent.framework
-
APMMobileAgent.framework/APMMobileAgent
-
APMMobileAgent.framework/APMMobileAgent.bundle
-
APMMobileAgent.framework/Headers
-
APMMobileAgent.framework//APMMobileAgent.bundle/AgentStartup.properties
hybrid/apmeum.js
hybrid/apmeumConfig.js
hybrid/apmeumBridge.js
-
-
Verify that the file
ApmMobileAgent.properties
is configured with the correct OMC details.
Configure APM with your Mobile Application:
These steps are documented for Xcode version 9.0. From your Xcode IDE, include the APM iOS Mobile Agent into your mobile application so that Application Performance Monitoring starts when the application starts:
Android: Requirements and Installation Instructions
You can deploy Application Performance Monitoring on a mobile device running on Android.
-
Android Studio version 3.0.1 and above
-
Android SDK API version 21 (Lollipop) and above.
-
Ensure that the
ANDROID_HOME
environment variable is set and it contains the path to Android SDK. Verify that the Android SDK contains the following sub folders such as platforms, platform-tools, and build-tools. Set theANDROID_HOME
property on My Computer as well as in the Android Studio Settings.Example:
ANDROID_HOME - C:\Android\sdk
-
Create
staticlibs
directory in the app's root folder (app/staticlibs
). Ensure that the app's root folder contains both thelibs
andstaticlibs
folders. -
If you have enabled Proguard in the Android app, then set the Proguard rules as follows:
-keepattributes EnclosingMethod -keepattributes InnerClasses -dontwarn InnerClasses -dontwarn com.oracle.diagnostics.instrumentor.** -keep class com.oracle.emaas.agent.android.instrumentation.** { *; } -keep class com.oracle.diagnostics.instrumentor.** { *; }
These Steps are documented for Android Studio 3.0.1.
-
Update the compile and runtime jar files (jar files extracted from the APM Agent Installer zip file).
-
Copy
apmandroidagentruntime.jar
toapp/libs
. -
Copy
apmdxagent.jar
to a location and update the path in thebuild.gradle
file.Example:
Note: It is recommended that you add thedependencies { classpath files('<path to apmdxagent.jar>/apmdxagent.jar') } apply plugin: 'com.oracle.agentplugin'
apply plugin
tag at the end of thebuild.gradle
file.
-
-
Repeat the above step in all the
build.gradle
in the app's library. -
Copy
ApmMobileAgent.properties
file into the app'sassets
folder (app/src/main/assets
). -
Create Application class extending
android.app.Application
if it does not exist and overrideonTrimMemory()
. Define application class name in the application tag of themanifest
file:package org.oracle.emaas.app123; import android.app.Application; public class app123Application extends Application { @Override public void onTrimMemory(int level) { } }
-
Edit the app's
AndroidManifest.xml
and do the following:-
Set the following permissions :
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-
Add the following in the
application
tag:<receiver android:name="com.oracle.emaas.agent.android.runtime.receiver.APMReceiver"/> <service android:name="com.oracle.emaas.agent.android.runtime.service.APMService"/>
-
- If you are running a hybrid mobile application:
-
- Copy the files
apmeum.js
andapmeumConfig.js
fromhybrid
directory into the app'ssrc js
directory. - The properties in the file
apmeumConfig.js
are set automatically after running the provisioning script. Verify to see if the properties are set correctly. - From the app's
src
folder, edit theindex.html
file, and add these below lines within thebody
tag.<script type="text/javascript" src="js/apmeumConfig.js"></script> <script async type="text/javascript" src="js/apmeum.js"></script>
- Repeat these steps for all the HTML pages in the app.
- Copy the files
-
-
If using Webviews, then set the Webview client and override the following methods:
onPageStarted(WebView view, String url, Bitmap favicon) onPageFinished(WebView view, String url) onReceivedError(WebView view, int errorCode, String description, String failingUrl)
-
Include the following in the app's
build.gradle
file to bypass errors that may be caused by APM Agent.android{ lintOptions { abortOnError false } }