Change network selection mode programmatically

扶醉桌前 提交于 2019-12-23 12:06:17

问题


I'm trying (wondering if it's even possible) to write an app, that would change the network selection mode automatically, based on some criteria. E.g. change the network operator from Vodafone to T-Mobile (assuming that the SIM card registration will succeed, but I'm not worried about it atm)

Unfortunately, I can't seem to find any way in the API to do it. Anyone has any idea? I assume, since it's not in the public APIs, there might still be a way to do it, if the phone is rooted. Is that true? If so, where should I look?

Thanks in advance


回答1:


Sorry but you can't.

You can have a look into the TelephonyManager .

You can know the current operator: getSimOperator(Name) / getNetworkOperator(Name).

You can also check this thread saying "I learn that for the sake of security there aren't any public APIs to manage this so the only option is to send the user to the system PreferenceScreen within my app."




回答2:


How about using android.telephony.CarrierConfigManager? I read about it on https://developer.android.com/reference/android/telephony/CarrierConfigManager.html and it seems to allow you to change alot of carrier-specific parameters, although the app must be signed with the certificate that has a matching signature to one on the SIM, so it can usually only be implemented by the carrier issuing the SIM. See also https://source.android.com/devices/tech/config/carrier.

I havent found an actual method to actively switch carrier, but if anywhere, I'd expect it to be there.



来源:https://stackoverflow.com/questions/6010190/change-network-selection-mode-programmatically

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