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.
- Download the file:
RegisterWithCrowdMob.java
- Copy
RegisterWithCrowdMob.java
into the same directory containing your main Android app activity. (Usually:YourApp/src/com/yourcompany/yourapp
) - Edit
RegisterWithCrowdMob.java
, and change the package fromcom.crowdmob.installs
to the package containing your main app activity. (Usually:com.yourcompany.yourapp
) - Edit your main activity class:
- Add a class-level constant for your app's secret key. (Like:
private static final String SECRET_KEY = "d2ef7da8a45891f2fee33747788903e7";
) - Add a class-level constant for your app's permalink. (Like:
private static final String PERMALINK = "your-app";
) - 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);
- Confirm your work against this example main activity class.
- Edit your
AndroidManifest.xml
file: - 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" />
- Confirm your work against this example
AndroidManifest.xml
file.
Congratulations! You've integrated your Android app with CrowdMob to track installs.
Now that you've integrated with CrowdMob to track installs, confirm that everything is working:
- Launch your app in your Android emulator, and examine the logs using LogCat.
- 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.