And as we all know... the trees do not grow into the sky ;-)
This morning, I tried this with a few Sony Ericsson phones I had at the
office. And they do not return anything when I try to get the
ro.product.version property. I still get the ro.build.fingerprint, but
nothing else.
Does anyone know if there is a place I can read the different handset
providers property names? A wiki somewhere...?
/rasmus
Den søndag den 29. april 2012 22.09.58 UTC+2 skrev JP:
>
> Hey guys...
>
> This code works... although I'm not that keen on it, since it is
> definitely not part of the jars available. But it works:
>
> @Override
> public void onCreate(Bundle savedInstanceState)
> {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> TextView arch = (TextView)findViewById(R.id.arch);
> TextView name = (TextView)findViewById(R.id.name);
> TextView version = (TextView)findViewById(R.id.version);
> TextView roversion = (TextView)findViewById(R.id.roversion);
> TextView rofingerprint =
> (TextView)findViewById(R.id.rofingerprint);
> arch.setText("os.arch: " + System.getProperty("os.arch"));
> name.setText("os.name: " + System.getProperty("os.name"));
> version.setText("os.version: " + System.getProperty("os.version"));
> roversion.setText("ro.product.version: " +
> getProp("ro.product.version", "Not found"));
> rofingerprint.setText("ro.build.fingerprint: " +
> getProp("ro.build.fingerprint", "Not found"));
>
> }
>
> private String getProp(String prop, String defaultVal)
> {
> String line = defaultVal;
> try {
> Process ifc = Runtime.getRuntime().exec("getprop " + prop);
> BufferedReader bis = new BufferedReader(new
> InputStreamReader(ifc.getInputStream()));
> line = bis.readLine();
> ifc.destroy();
> } catch (java.io.IOException e) {
> }
>
> return line;
> }
>
> This returns:
>
> TextView arch = (TextView)findViewById(R.id.arch);
> TextView name = (TextView)findViewById(R.id.name);
> TextView version = (TextView)findViewById(R.id.version);
> TextView roversion = (TextView)findViewById(R.id.roversion);
> TextView rofingerprint = (TextView)findViewById(R.id.rofingerprint);
> arch.setText("os.arch: " + System.getProperty("os.arch"));
> name.setText("os.name: " + System.getProperty("os.name"));
> version.setText("os.version: " + System.getProperty("os.version"));
> roversion.setText("ro.product.version: " +
> System.getProperty("ro.product.version"));
> rofingerprint.setText("ro.build.fingerprint: " +
> System.getProperty("ro.build.fingerprint"));
>
> Which gave me this output on my HTC Legend:
> os.arch : armv6l
> os.name: Linux
> os.version: 2.6.32.17-g30929af
> ro.product.version: 3.15.405.3
> ro.build.fingerprint:
> htc_wwe/htc_legend/legend/legend:2.2/FRF91/291292:user/release-keys
>
>
> On Sunday, April 29, 2012 12:30:36 PM UTC+2, JP wrote:
>>
>> I tried using this code:
>>
>> TextView arch = (TextView)findViewById(R.id.arch);
>> TextView name = (TextView)findViewById(R.id.name);
>> TextView version = (TextView)findViewById(R.id.version);
>> TextView roversion = (TextView)findViewById(R.id.roversion);
>> TextView rofingerprint = (TextView)findViewById(R.id.rofingerprint);
>> arch.setText("os.arch: " + System.getProperty("os.arch"));
>> name.setText("os.name: " + System.getProperty("os.name"));
>> version.setText("os.version: " + System.getProperty("os.version"));
>> roversion.setText("ro.product.version: " +
>> System.getProperty("ro.product.version"));
>> rofingerprint.setText("ro.build.fingerprint: " +
>> System.getProperty("ro.build.fingerprint"));
>>
>> Which gave me this output on my HTC Legend:
>> os.arch : armv6l
>> os.name: Linux
>> os.version: 2.6.32.17-g30929af
>> ro.product.version: null
>> ro.build.fingerprint: null
>>
>> So this didn't work either unfortunately... I'll keep looking!
>>
>> JP
>>
>>
>>
>> On Monday, April 23, 2012 4:53:25 PM UTC+2, Chris Stratton wrote:
>>>
>>> On Monday, April 23, 2012 7:54:50 AM UTC-4, JP wrote:
>>>>
>>>> Didn't find anything unfortunately. Is this really impossible to do?
>>>
>>>
>>> Open an adb shell, type "getprop" and look at the result.
>>>
>>> Some entries which may be of interest:
>>> ro.build.fingerprint
>>> ro.build.version.*
>>> ro.product.version
>>>
>>> These should be readable by apps; what I don't know off the top of my
>>> head is which (if any) are "stable API's" and which are private and thus
>>> subject to change without notice.
>>>
>>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en