Android Wifi Settings within app(Kiosk-sh app)

五迷三道 提交于 2019-12-22 13:56:14

问题


So I am writing a app that runs on Android 4.4.2. I need to make my app be the only thing that is capable of running(Like what many call kiosk mode). The device manufacturer is removing the top menu bar and navigation bar so the user can't access anything but our app that is assigned to be the home screen.

The only issue is I need the user to be able to setup wifi networks, but do now want them to have access to any other settings of any kind.

Ideally I just want a wifi settings popup that occasionally comes up on other devices when you enable wifi.

Is there any way to achieve this without writing my own wifi configuration menu?

Thanks.

EDIT: To clarify, I have tried simple intents but they do not achieve what is needed. they result in something like this: http://g04.s.alicdn.com/kf/HT135ULFO0cXXagOFbXV/2503257/HT135ULFO0cXXagOFbXV.jpg Where the user will still have access other settings.

Ive used

startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));

startActivityForResult(new Intent(Settings.ACTION_WIFI_SETTINGS), 0);

I was hoping the second one would open a dialog and not the settings but it didn't work.


回答1:


The following should accomplish what you're after:

Intent intent = new Intent("com.android.net.wifi.SETUP_WIFI_NETWORK");
intent.setComponent(ComponentName.unflattenFromString("com.android.settings/com.android.settings.wifi.WifiSetupActivity"));
intent.addCategory("android.intent.category.DEFAULT");
startActivity(intent);

I came up with this after needing to do something very similar and hunting through the source of the Android Settings activities. As far as I can tell, there isn't a defined action to launch the wifi activity without all the other settings listed out, but we can get to it by assembling the intent manually.



来源:https://stackoverflow.com/questions/27626452/android-wifi-settings-within-appkiosk-sh-app

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