Skip to content

crowdmob/integrate-android

Repository files navigation

CrowdMob Android Integration and App Installs Tracking

CrowdMob (http://deals.crowdmob.com/) drives installs of your Android mobile app. You can integrate your mobile app with CrowdMob's installs tracking service by following these integration instructions.

Integration Instructions

  1. Download the file: RegisterWithCrowdMob.java
  2. Copy RegisterWithCrowdMob.java into the same directory containing your main Android app activity. (Usually: YourApp/src/com/yourcompany/yourapp)
  3. Edit RegisterWithCrowdMob.java, and change the package from com.crowdmob.installs to the package containing your main app activity. (Usually: com.yourcompany.yourapp)
  4. Edit your main activity class:
  5. Add a class-level constant for your app's secret key. (Like: private static final String SECRET_KEY = "d2ef7da8a45891f2fee33747788903e7";)
  6. Add a class-level constant for your app's permalink. (Like: private static final String PERMALINK = "your-app";)
  7. At the very bottom of your onCreate() method, call the code to register your app's install with CrowdMob: RegisterWithCrowdMob.trackAppInstallation(this, SECRET_KEY, PERMALINK);
  8. Confirm your work against this example main activity class.
  9. Edit your AndroidManifest.xml file:
  10. At the very bottom, within the <manifest> tag, add the following lines: 1. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 2. <uses-permission android:name="android.permission.INTERNET" /> 3. <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 4. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  11. Confirm your work against this example AndroidManifest.xml file.

Congratulations! You've integrated your Android app with CrowdMob to track installs.

Testing Your Integration

Now that you've integrated with CrowdMob to track installs, confirm that everything is working:

  1. Launch your app in your Android emulator, and examine the logs using LogCat.
  2. Look for the following log entry: registered app installation with CrowdMob, HTTP status code 200

The following table describes what the various HTTP status codes mean:

  • 400: At least one parameter was not supplied.
  • 403: Your security hash doesn’t match the expected value.
  • 404: Your specified app permalink doesn’t correspond to an app registered with CrowdMob.
  • 200: Your request was well formed and was properly processed by CrowdMob’s server.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages