Reputation: 4570
I want to track all the Installs of my App as I will be uploading it on my WebSite for download and not PlayStore, and I've read about Google Analytics but I don't want to track screens and all.. Is there any easier way/library or something to track my App installs...
Upvotes: 0
Views: 1096
Reputation: 8835
You need to create an BroadcastReceiver like this in manifiest file
<receiver
android:name="com.domain.package.CustomReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
and receive into a class like this
public class CustomReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Bundle b= intent.getExtras();
String referrerString = b.getString("referrer");
// Log.e("bundle", "bundle= " + referrerString+ " " + referrerString.substring(11, referrerString.length()));
SharedPrefManager.setPrefVal(context, Constants.REFERRAL, referrerString.substring(11, referrerString.length()));
}
}
and at this point you will get an referrer link from the playstore. you just need to save and send this to server using webservices. so that you can track your app installs.
Upvotes: 0
Reputation: 3882
You cant track install from the app. You can get phone identifier and hit some backend endpoint with it. You can use Google Analytics events for this, this is the simplest way. Also you can track downloads from site and use it as an install event, cause i don't think that there will be many users who will download app, but not install it.
Upvotes: 0
Reputation: 10012
create a service for your mobile App in your website. whenever a user download application from website and installs it. Then hit that service from your mobile app. The service when receives the request from your application store it in the database. make sure that your database table contains a unique identifier for e.g. device id/mac address. in order to track installs
Upvotes: 1