There are 2 main areas of functionality provided: (1) AppServices (Usergrid), and (2) App Monitoring. App Services provides server-side storage functionality. App Monitoring provides crash reporting, error tracking, application configuration management, and network performance monitoring. You may use both of these areas or decide to just use one of them.
To initialize the App Services SDK, do the following:
- Add 'apigee-android-.jar' to the build path for your project.
- Add the following to your source code to import commonly used SDK classes:
import com.apigee.sdk.ApigeeClient; import com.apigee.sdk.data.client.DataClient; import com.apigee.sdk.apm.android.MonitoringClient; import com.apigee.sdk.apm.android.AndroidLog; import com.apigee.sdk.data.client.callbacks.ApiResponseCallback; import com.apigee.sdk.data.client.response.ApiResponse;
- Add the following to your 'AndroidManifest.xml':
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- If it is present in your project, remove 'android.util.log'. The 'AndroidLog' class of the App Services SDK replaces the functionality of 'android.util.log'.
- Instantiate the 'ApigeeClient' class to initialize the App Services SDK:
//App Services app credentials, available in the admin portal String ORGNAME = "your-org"; String APPNAME = "your-app"; ApigeeClient apigeeClient = new ApigeeClient(ORGNAME,APPNAME,this.getBaseContext());
Once the SDK has been initialized, App Services will automatically begin logging usage, crash and error metrics for your app. This information can be viewed in the App Services admin portal for your account.
To build from source using Gradle, issue this command from the 'source' directory of your repository:
gradle shadowJar
To run unit tests using Gradle, issue this command from the 'source' directory of your repository:
gradle test
The results of the tests can be seen by looking at the created file located at 'source/build/reports/tests/index.html'.
New classes (Collection, Entity, Device, Group in package com.apigee.sdk.data.client.entities) to make working with entities and collections easier. The functionality has been modeled after our JavaScript and PHP SDKs.
(1) Package names have changed from org.usergrid.java.client and org.usergrid.android.client to com.apigee.sdk.data.client. (2) Client is now named DataClient (package com.apigee.sdk.data.client) (3) Initialization is performed with ApigeeClient (new class in package com.apigee.sdk)