Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,743,029 Members 42,014 Now Online
XDA Developers Android and Mobile Development Forum
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

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

Tip us?
 
mcbyte_it
Old
(Last edited by mcbyte_it; 22nd July 2013 at 02:28 PM.)
#1  
mcbyte_it's Avatar
Senior Member - OP
Thanks Meter 265
Posts: 753
Join Date: Nov 2008
Default [APP] ROM Stats: usage statistics for ROM developer (a la Cyanogenmod Stats)

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:	1496
Size:	19.7 KB
ID:	1722734 Click image for larger version

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

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

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

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

Name:	stats-site.jpg
Views:	1713
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:
Select 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, 370 views)
File Type: zip romstats_website.zip - [Click for QR Code] (10.0 KB, 303 views)

Device 1: OnePlus One 64GB (KK 4.4.2 | CM11s)
Device 2: Nexus 10 16GB (KK 4.4.4)
Other projects: ROM Stats v2.0 beta | weekly init.d scripts | Daily Free App @ Amazon (Europe SUPPORTED)
The Following 23 Users Say Thank You to mcbyte_it For This Useful Post: [ Click to Expand ]
 
Andy
Old
#2  
Andy's Avatar
Forum Moderator
Thanks Meter 5259
Posts: 4,064
Join Date: Jan 2008
Location: UK

 
DONATE TO ME
Thread Moved,
-
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." - Albert Einstein
"Tech support PMs will be ignored" - Andy
 
mcbyte_it
Old
#3  
mcbyte_it's Avatar
Senior Member - OP
Thanks Meter 265
Posts: 753
Join Date: Nov 2008
Just published the source code on GitHub, and attached a compiled version on the original post...

Device 1: OnePlus One 64GB (KK 4.4.2 | CM11s)
Device 2: Nexus 10 16GB (KK 4.4.4)
Other projects: ROM Stats v2.0 beta | weekly init.d scripts | Daily Free App @ Amazon (Europe SUPPORTED)
The Following 3 Users Say Thank You to mcbyte_it For This Useful Post: [ Click to Expand ]
 
AdamOutler
Old
#4  
AdamOutler's Avatar
Recognized Developer
Thanks Meter 9556
Posts: 5,182
Join Date: Feb 2011
Location: Louisiana

 
DONATE TO ME
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.
Flash with Odin on Windows, Linux and Mac. Use JOdin3, Available in a web browser or offline
Check out my developer pages. Add me to your circles on Google Plus.
Wanna see the longest Linux BASH script ever made? click here.
 
mcbyte_it
Old
(Last edited by mcbyte_it; 4th February 2013 at 08:29 PM.)
#5  
mcbyte_it's Avatar
Senior Member - OP
Thanks Meter 265
Posts: 753
Join Date: Nov 2008
Quote:
Originally Posted by AdamOutler View Post
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?

Device 1: OnePlus One 64GB (KK 4.4.2 | CM11s)
Device 2: Nexus 10 16GB (KK 4.4.4)
Other projects: ROM Stats v2.0 beta | weekly init.d scripts | Daily Free App @ Amazon (Europe SUPPORTED)
The Following User Says Thank You to mcbyte_it For This Useful Post: [ Click to Expand ]
 
Entropy512
Old
#6  
Senior Recognized Developer
Thanks Meter 24128
Posts: 13,144
Join Date: Aug 2007
Location: Owego, NY

 
DONATE TO ME
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.
*so much sig updating needed*

My Github profile - Some Android stuff, some AVR stuff

An excellent post on "noobs vs. developers"

A few opinions on kernel development "good practices"

Note: I have chosen not to use XDA's "friends" feature - I will reject all incoming "friend" requests.

Code:
<MikeyMike01> Smali is a spawn of hell
<shoman94> ^^^ +!
Code:
<Entropy512> gotta be careful not to step on each other's work.  :)
<Bumble-Bee> thats true
<jerdog> compeete for donations
 
mcbyte_it
Old
(Last edited by mcbyte_it; 5th February 2013 at 11:11 AM.)
#7  
mcbyte_it's Avatar
Senior Member - OP
Thanks Meter 265
Posts: 753
Join Date: Nov 2008
Quote:
Originally Posted by Entropy512 View Post
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

Device 1: OnePlus One 64GB (KK 4.4.2 | CM11s)
Device 2: Nexus 10 16GB (KK 4.4.4)
Other projects: ROM Stats v2.0 beta | weekly init.d scripts | Daily Free App @ Amazon (Europe SUPPORTED)
The Following 2 Users Say Thank You to mcbyte_it For This Useful Post: [ Click to Expand ]
 
azoller1
Old
#8  
azoller1's Avatar
Senior Member
Thanks Meter 1606
Posts: 1,748
Join Date: Aug 2011
Location: Lenexa

 
DONATE TO ME
Default 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
DONATIONS WOULD BE NICE!!-- HERE

Device: LG Spectrum 16GB 4G
Rom: Running Beanstalk Builds
Kernel: Running My S-Kernel JB

Device: Asus TF300T 32GB
Rom: Running My Own CyanogenMod Builds
Kernel: Running Stock CM Kernel

MY DEV
GOO.IM FILES/FOLDERS
ANDROID FILE HOST DEVICES
SOURCEFORGE FILES
 
Sentinel196
Old
#9  
Sentinel196's Avatar
Recognized Contributor
Thanks Meter 3775
Posts: 3,171
Join Date: Mar 2010

 
DONATE TO ME
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!!!




Be sure to check out our new/free Android game - Can you be the Wheelie King?
 
pabloltg
Old
(Last edited by pabloltg; 12th February 2013 at 05:24 AM.)
#10  
pabloltg's Avatar
Senior Member
Thanks Meter 198
Posts: 267
Join Date: Jan 2012
Location: Córdoba
I need help...

I got this in mysite/stats
Code:
Select 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!!

The Following User Says Thank You to pabloltg For This Useful Post: [ Click to Expand ]
Tags
anonymous stats, cm stats, rom stats, rom usage
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes