There is Build.SERIAL
static field for instance. Is there another way to get this value rather than just reading it from static field?
Asked
Active
Viewed 63 times
0

eleven
- 6,779
- 2
- 32
- 52
-
1But is it not easy to read this way? – siva Mar 20 '17 at 15:07
-
1For those who don't know any other way (like me), explaining the reason behind it could help us understand the problem and provide other solutions. – JonZarate Mar 20 '17 at 15:08
-
@7383 it's easy, I just wan't to understand if there is any other way. – eleven Mar 20 '17 at 15:15
-
1@JonZarate there're lots of libraries which could use `Build` values. I'm interested if I change Build values with reflection which values libraries can receive. – eleven Mar 20 '17 at 15:24
-
how about reflection? perhaps this will help: http://stackoverflow.com/a/13401094/794088 – petey Mar 20 '17 at 15:26
-
So you need private data, why do you need it from `Build`? Store it in a database, web server etc. and read it from there. Why do you need such an id from the phone? – JonZarate Mar 20 '17 at 15:28
-
1According to [this](http://android.stackexchange.com/questions/26572/changing-android-os-build-serial) answer, I believe root user can read it from the file itself. – Shreyash S Sarnayak Mar 20 '17 at 15:43
1 Answers
1
Something like this can work. Only reason why someone would use it, I can think of private static field
, witch can be accessed only form class where it is declared. You can get access from another class through getter method.
private static String abcd = "ABCD";
public String getAbcd(){
return this.abcd;
}

miljon
- 2,611
- 1
- 16
- 19