Reputation: 118
Android provides the following method to determine the network operator: http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNetworkOperatorName()
However even the documentation specifically says:
Returns the alphabetic name of current registered operator. Availability: Only when user is registered to a network. Result may be unreliable on CDMA networks (use getPhoneType() to determine if on a CDMA network).
The problem is that we need a reliable way to detect the carrier so we can identify the traffic source. Has anyone had a similar problem and if so, what is the best solution?
Upvotes: 6
Views: 2433
Reputation: 31
My phone is on Verizon Wireless. On a daily basis, I drive through areas where my phone is roaming and/or has poor reception. Using scripting layer for android, I will log the results of calling getOperatorName() once every ten minutes over the next week.
There is another method that might work in the android.telephony.cdma api. The documentation there is missing the reliability disclaimer. You would only get a Network ID instead of a name. Unfortunately, this requires API level 5 instead of 1 if that matters to you.
Logging the results of the getOperatorName() method yielded nothing special. When I had no service it consistently returned null and when I had service it consistently returned "Verizon Wireless." I'm sure that's not very helpful.
Edit: Addition and correction. Added - Explanation of link Corrected - API level 5 not 17
Edit 2: Test results
Upvotes: 2
Reputation: 6783
I am currently looking for a solution for this problem as well. According to this thread one could use CdmaCellLocation.getNetworkId
and CdmaCellLocation.getSystemId
. Since there are no CDMA networks in Germany, I am unable to check if this works...
Upvotes: 0
Reputation: 31
You think maybe this was one precurser to Google pulling cdma support? Play within the frameworks or find you another playground is what I hear Google saying. Well that and the fact that carrier apps burned into roms have at times left gaping holes in security. As to a possible answer to your question... from where are you able to pull info? APN settings might tell you or an assert to a known carrier line in build.prop could pull the info I might need for example. (I do the hobby roms). Then again if you physically inspect a phone, the carrier is usually branded ;) From what vantage are you pulling the info?
Rob
Upvotes: -1