Is telephony manager values reliable and changeable (cdma)?

Deadly 提交于 2019-12-23 17:21:46

问题


I want to know if I can rely on the telephony values like country, MCC, etc on Android for my app. Can I change them on the run using setprop? I tried changing using setprop it didn't seem to work. From my understanding telephony manager is a class/interface which represents Hardware configuration of GSM or CDMA. In case of GSM this could be sim and in case of CDMA it cud be a hardware. My questions are:

  • Who update these values in both the cases for the first time?
  • Are these values are saved by OS as read only?
  • What if a user travels to different country or zone will some of the values like country code and MCC values updated automatically?
  • Can I reset these values?

I have no intention of changing any of these values but want to understand its working! I would appreciate if someone can help me on this.


回答1:


According to android documentation

Provides access to information about the telephony services on the device. Applications can use the methods in this class to determine telephony services and states, as well as to access some types of subscriber information. Applications can also register a listener to receive notification of telephony state changes.

TelephonyManager is used for reading phone information. Regarding your question about MCC & MNC codes: yes, they will change when phone will be in other country. You can subscribe to receive those events and determine that user now in different country.




回答2:


@Bo The way CDMA works is different from GSM. CDMA has always got one home base and many visitor base location. and you can always get to know about visitor Operator using TelephonyManager methods which is considered as unreliable for CDMA.




回答3:


I decided to add it as answer as well...

I found a way to tackle this problem on CDMA phone.. if it is a CDMA phone , then the phone always has an ICC hardware comparable to SIM cards in GSM. All you gotta do is use the system properties associated with the hard ware . Programmatically you can use Java reflection to get this information . This is not changeable even system is rooted unlike GSM device. Class c=Class.forName("android.os.SystemProperties"); Method get = c.getMethod("get", String.class); String homeOperator = ((String) get.invoke(c, "ro.cdma.home.operator.numeric"));



来源:https://stackoverflow.com/questions/11551078/is-telephony-manager-values-reliable-and-changeable-cdma

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!