Detect if data connection has been disabled
I am struggling with an issue relating to the licensing service and network connection.
The bottom line is I want the LVL to work if the user is in the middle of nowhere with no signal, but I don't want them to be able to 'cheat' and turn off the data connection.
I already have detected and intercepted airplane mode, but some phones or apps let you turn data connection on or off. (some don't)
My Epic 4g allows this, and I think the hidden API letting us control this is not working past 2.0 release. (iTelephony)
However is it possible to simply detect if the connection was disabled and not change that fact but simply react to it?
I can already detect wheth开发者_StackOverflow中文版er or not there is a data connection or not- what I want is to tell the difference between a disabled antenna and simply not having signal. The market licensing check will fail and I want to give 'em a pass if they legitimately have no signal, but not if they forced it off.
Well, I don't need to check whether net has been disabled outside of airplane mode, I found a different solution here:
http://code.google.com/p/androidbest/
What this code does is force the user to authenticate at least once. Then if it fails to connect to the LVL server, it uses a cached authentication. I had to change it a bit, notably it was launching the next activity twice, and now it solves my issue adequately.
精彩评论