Android SDK Instructional Guide
Implementing an App measurement SDK can be more difficult than a standard webpage tag implementation. This instructional guide includes a guide for developers to help implement and test the EM App SDK. A downloadable test App can be downloaded and installed within Android Studio. The test App has helpful comments within the code and notifications that pop up to alert the user when the code has been triggered. Walking through the following guide with the test App installed should make the SDK implementation a simpler task, but if you still have any questions or concerns, please contact the EM support team.
You must have the following installed before you can begin the implementation:
- Android Studio
- Android SDK 5.x
Steps to configure EM-Test-Application
After downloading the EM Test-Application, please follow the next steps to install the App.
- Unzip the testing-app.zip
- Open Android studio and File->Open->Choose the location of testing-app folder.
- Sync project with gradle file and run the project.
Loading the application
Once installed, when loaded the EM Test App should load as seen below. Upon load, the code will be triggered and a notification will appear that says "Page Impression has been sent to EM". The "impression" should emulate that of a standard webpage, where we capture some data after the page has loaded. If you have tagged up your website with EM code, you should be familiar with the tagging rules for code implementation. If you are unaware of code implementation rules, please read the following help page: Tag Implementation Guidelines
Home page of Application
This page when loaded, will show that a page has loaded with a notification appearing on the screen. There is also a "EM Test Tag" button that will also trigger the code, to further illustrate how the code works. If you view the source of this code, you should be able to see the method that triggers both of these events.
If you navigate to the application menu, there is a "Screen" menu item you can click. This will take you to another screen within the App and it will trigger the code again.
This is an image of the "Screen" page, with the notification that appears once the code has been triggered.
Logcat in Android studio
If you have followed the code examples above, you should be able to successfully implement the App SDK in Android studio. To ensure your implementation is correct, it is recommended to check that the code is being sent to the EM servers via logcat.If you test your App and see the "EmTrackerActivity" events appear, that means that the implementation is fine. Let the EM support team know that you have implemented the code and it looks good, and they will ensure that the data is appearing in the dashboard.