[APP] ROM Stats: usage statistics for ROM developer (a la Cyanogenmod Stats)
CyanogenMod has a feature to report anonymous Statistics to the Cyanogenmod Team: on first boot the user is given the choice to send anonymous statistics to CyanogenMod website (http://stats.cyanogenmod.com
I needed to track the usage of a ROM i cooked, so I went ahead and pulled the source code of this feature the CyanogenMod GitHub
, made some modifications to make it run on any Rom (Android > 2.3.3), and here it is, available for anybody who wants to use it in their ROM.
To use this in a ROM, it should contain the RomStats.apk (attached) as either a User or a System app, and then add these lines in the main build.prop of the ROM (under /system):
# ROM Statistics and ROM Identification
ro.romstats.name=[The desired ROM name]
Then there needs to be a web application on the server as the domain (the URL parameter) where the data is submitted. For that now I wrote a simple php page with a mysql database to save the data. You will find the application attached to this thread (romstats_website.zip).
The submitted data contains:
- Device hash: which is an MD5 hash of the IMEI (or wifi MAC, if imei is unavailable for some reason)
- Device name: the property "ro.product.model" of build.prop
- Device version: the property "ro.build.display.id" of build.prop
- Country: from the Android API, getNetworkCountryIso
- Carrier: from the Android API, getNetworkOperatorName
- Carier ID: from the Android API, getNetworkOperator
- ROM Name: from the newly added property "ro.romstats.name"
- ROM version: from the newly added property "ro.romstats.version"
in addition to this data, the database has an extra 2 columns:
- First registration date: the first time the device registered on the server
- Last check-in date: the last time the device (with same device hash) checked in, to remove inactive devices after X days
ROMs that use ROM Stats are:
Installing the Web component:
The web component (romstats_website.zip) is a simple php application that has 2 parts:
you will also find the script to create the database table, a single very simple one to collect the data.
I also included a .htaccess file, this is because I want the web component to be independent from the server technology. the client will submit the information to the www.domain.com/subfolder/submit (without the .php extension), the .htaccess is what translates the /stats to /stats.php
If you want to implement the Web component with other technologies, just be sure that the submit component works in the same way.
The Stats page has a note that devices which don't report for 90 days are removed from the db, this has not been done yet, it is just a simple query to add in the submit.php or to a cron job.
I know that users like to remain anonymous, and most don't like to be tracked, but this kind of tracking is a great method for ROM developers to have statistics on the usage of their creation.
Any feedback is welcome.
Source code of the app is available on GitHub
added a new option (Uninstall) in the main screen which will appear if the app is installed as a User app (not system), this will allow the end user to uninstall the stats app completely from the deivce, and not just opt-out of stat submitting.
added a new parameter for the build.prop (tframe) that allows developers to decide the interval of checkins, if not set, app will use 7 days as default.
ROM Stats has been featured on XDA Developers Home page