How to Enable Anonymous Usage Statistics In Your ROM
Anyone who has ever flashed a build of CyanogenMod could not have possibly failed to notice the initial notification after a fresh install. That’s right, the one asking whether or not you would like to opt in to allow the transmission of anonymous usage statistics from your device. For any developers out there who would also like to keep track of how their work is being used, XDA Senior Member mcbyte_it has made that a lot easier to implement. And as we already provide this information to Google, we may as well help out any curious developers as well, right?
The information in question is completely non-invasive and anonymous. It consists of an MD5 hash of either IMEI or WiFi MAC address, country and carrier info, device model/version and ROM name/version. It also sends a record of the first check in and last check in which enables the removal of inactive devices from the database. This should help to give developers a pretty clear picture of where their work is used and on which devices.
The process of implementing this into your ROM is pretty straightforward and consists of two procedures. The first requires you to add the Romstats.apk file into your ROM as either a system or user app (if you’d prefer to give the user the option of uninstalling as well as opting out), and making the necessary amendments to the build.prop file. The application itself is created from the original sources of the CyanogenMod statistics reporting APK, and the sources are available from a Github link in thread. The second part of the process involves setting up a web application to receive and store the data. Mcbyte_it’s solution to this is simple: PHP page and Mysql database to store the data.
Everything you need to set this up can be found in the original forum thread, so be sure to check it out if you’d like to implement this.