开发者

Hiding permission intent in Android?

As we know, Android OS has some restrictions to operate device hardwares programmetically, like it shows intent to user which requires YES for return true to the specific intent, i-e:

Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, 1);

I want to hide this intent from user, and want to return true, as if user click YES, is there any way to code like this ?

I am not asking about turn ON bluetooth without permission, like( myBlueToothAdapter.enable() works) I have to hide another intent which works same as this one..

开发者_如何学运维

Hope someone can guide me to the proper way. Thanks in advance.


The security mechanisms in place for Android would inherently forbid this.


I am not quite understand you are asking. It seems that you don't want to use the built-in Intent that requests the user to turn on the bluetooth radio. If this is the case, you are saying you want to have your own intent (activity) that ask the user to turn on/off bluetooth? You can use BluetoothAdapter.enable() in your activity to do this. OR you can use that API to turn on bluetooth without asking the user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜