The SystemProperties provide a bunch of data of the current Phone-'Properties', like:
- the operator-Name (i.e.: "T-Mobile" or "AT&T"
- the ISO-Country-Name (i.e.: "us" or "de")
- and of course your Phone-Number
This is how to get these Strings into your Java-Code:
| Java: |
String phoneNumber = android.os.SystemProperties.get( android.telephony.TelephonyProperties.PROPERTY_LINE1_NUMBER); String operatorISOCountry = android.os.SystemProperties.get( android.telephony.TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY); String operatorName =android.os.SystemProperties.get( android.telephony.TelephonyProperties.PROPERTY_OPERATOR_ALPHA);; |
On the emulator this will return: "15555218135", "us" and "Android".
reference: [origin]

沒有留言:
張貼留言