Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
View Poll Results: Should ROMStats app be published on the Play Store?
Yes 2 33.33%
No 4 66.67%
Voters: 6. You may not vote on this poll

Post Reply

[APP] ROM Stats: usage statistics for ROM developer (a la Cyanogenmod Stats)

OP mcbyte_it

7th January 2013, 02:26 PM   |  #1  
mcbyte_it's Avatar
OP Senior Member
Thanks Meter: 281
 
782 posts
Join Date:Joined: Nov 2008
More
ROM Stats v2.0 beta is being developed, check what's new here

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.

Click image for larger version

Name:	screenshot_2013-02-12_08-29-34.jpg
Views:	1733
Size:	19.7 KB
ID:	1722734 Click image for larger version

Name:	screenshot_2013-02-12_08-29-43.jpg
Views:	1594
Size:	14.9 KB
ID:	1722735 Click image for larger version

Name:	screenshot_2013-02-12_08-29-49.jpg
Views:	1562
Size:	40.5 KB
ID:	1722736 Click image for larger version

Name:	screenshot_2013-02-12_08-29-57.jpg
Views:	1420
Size:	19.6 KB
ID:	1722737 Click image for larger version

Name:	screenshot_2013-02-12_08-30-07.jpg
Views:	1349
Size:	16.5 KB
ID:	1722738 Click image for larger version

Name:	stats-site.jpg
Views:	1916
Size:	81.4 KB
ID:	1624677

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):
Code:
# ROM Statistics and ROM Identification
ro.romstats.url=http://www.[domainname].com/[subfolder]/
ro.romstats.name=[The desired ROM name]
ro.romstats.version=[ROM Version]
ro.romstats.tframe=7
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:
1- submit.php
2- stats.php

you will also find the script to create the database table, a single very simple one to collect the data.

The submit.php is the component that receives the stats from the devices, while the stats.php is what displays the information for the users/devs (as CSS, it uses the Bootstrap framework, hosted on the BootstrapCDN provider (no css or javascript in my package).

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

UPDATE 28/01/2013
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.

UPDATE 02/02/2013
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.

UPDATE 12/02/2013
ROM Stats has been featured on XDA Developers Home page
Attached Files
File Type: apk RomStats.apk - [Click for QR Code] (79.2 KB, 418 views)
File Type: zip romstats_website.zip - [Click for QR Code] (10.0 KB, 360 views)
Last edited by mcbyte_it; 22nd July 2013 at 03:28 PM.
The Following 24 Users Say Thank You to mcbyte_it For This Useful Post: [ View ]
25th January 2013, 06:43 PM   |  #2  
Andy's Avatar
Forum Moderator
Flag UK
Thanks Meter: 5,375
 
4,150 posts
Join Date:Joined: Jan 2008
Donate to Me
More
Thread Moved,
2nd February 2013, 02:59 PM   |  #3  
mcbyte_it's Avatar
OP Senior Member
Thanks Meter: 281
 
782 posts
Join Date:Joined: Nov 2008
More
Just published the source code on GitHub, and attached a compiled version on the original post...
The Following 3 Users Say Thank You to mcbyte_it For This Useful Post: [ View ]
4th February 2013, 05:18 PM   |  #4  
so how do I build my own Cyanogenmod Stats compliant site? I want to have stats for a separate java application and as far as I can see, this is useful for reporting to Cyanognenmod Stats.
4th February 2013, 09:24 PM   |  #5  
mcbyte_it's Avatar
OP Senior Member
Thanks Meter: 281
 
782 posts
Join Date:Joined: Nov 2008
More
Quote:
Originally Posted by AdamOutler

so how do I build my own Cyanogenmod Stats compliant site? I want to have stats for a separate java application and as far as I can see, this is useful for reporting to Cyanognenmod Stats.

I attached the php code of the web component/site I use for my ROM in the first thread, together with some information on how it works. If you need other help, I will be glad to help.

What do you mean by wanting to have stats for a java application? you don't want to use it in a ROM?
Last edited by mcbyte_it; 4th February 2013 at 09:29 PM.
The Following User Says Thank You to mcbyte_it For This Useful Post: [ View ]
5th February 2013, 12:32 AM   |  #6  
Senior Recognized Developer
Flag Owego, NY
Thanks Meter: 24,797
 
13,532 posts
Join Date:Joined: Aug 2007
Donate to Me
More
If you want to track statistics of your own firmware, you should set up your own server infrastructure to do so... I'm fairly certain using CM's server infrastructure for a purpose such as this is NOT kosher. (I'm checking with some of the other CM people to make sure...)

Edit: On reading further, you DO appear to be creating your own server infrastructure? If you're not using CM's servers I'm fairly certain this is OK.
5th February 2013, 08:08 AM   |  #7  
mcbyte_it's Avatar
OP Senior Member
Thanks Meter: 281
 
782 posts
Join Date:Joined: Nov 2008
More
Quote:
Originally Posted by Entropy512

If you want to track statistics of your own firmware, you should set up your own server infrastructure to do so... I'm fairly certain using CM's server infrastructure for a purpose such as this is NOT kosher. (I'm checking with some of the other CM people to make sure...)

Edit: On reading further, you DO appear to be creating your own server infrastructure? If you're not using CM's servers I'm fairly certain this is OK.

Sure I am using my own infrastructure, I just used their CM Stats Android code as a base of my ROM Stats app, nothing else
Last edited by mcbyte_it; 5th February 2013 at 12:11 PM.
The Following 2 Users Say Thank You to mcbyte_it For This Useful Post: [ View ]
9th February 2013, 05:33 PM   |  #8  
azoller1's Avatar
Senior Member
Flag Lenexa
Thanks Meter: 1,667
 
1,777 posts
Join Date:Joined: Aug 2011
Donate to Me
More
Re: [APP] ROM Stats: usage statistics for ROM developer (a la Cyanogenmod Stats)
Thanks so all I need is that apk the lines and a website?

Sent from my VS920 4G using Tapatalk 2
12th February 2013, 02:14 AM   |  #9  
Sentinel196's Avatar
Recognized Contributor
Thanks Meter: 3,777
 
3,171 posts
Join Date:Joined: Mar 2010
Donate to Me
More
You dead set legend!!! I was just about to tackle this task tonight for my ROM. Your hard work will make mine so much easier!! THANKYOU!!!
12th February 2013, 03:06 AM   |  #10  
pabloltg's Avatar
Senior Member
Flag Córdoba
Thanks Meter: 201
 
267 posts
Join Date:Joined: Jan 2012
More
I need help...

I got this in mysite/stats
Code:
QUERY: SELECT count(1) FROM zrom_stats
ERROR: Table 'u975064066_black.zrom_stats' doesn't exist

Solved: I just import create_db_table in myphpAdmin

Works like a charm!!
Last edited by pabloltg; 12th February 2013 at 06:24 AM.

The Following User Says Thank You to pabloltg For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
anonymous stats, cm stats, rom stats, rom usage
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes