Android 6.0.1 couldn't enable wifi hotspot programmatically

前端 未结 5 1768
孤城傲影
孤城傲影 2021-02-09 02:20

When I tried to enable wifi tethering from the following code it throws the exception

java.lang.reflect.InvocationTargetException at java.lang.reflect.Method

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-09 03:08

    I think Android M don't support to create hotspot programmatically . You can take your Marshmallow user to settings page to create hotspot by himself. below code will help yo to go setting page.

      startActivity(
        new Intent(Settings.ACTION_SETTINGS));
    

提交回复
热议问题