Android 6.0.1 couldn't enable wifi hotspot programmatically

前端 未结 5 1746
孤城傲影
孤城傲影 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条回答
  •  有刺的猬
    2021-02-09 03:07

    This is not the correct way.But this fixed the issue.

    Changed the target sdk version to 21. Then hotspot will start programmatically even in android 6.0.1. Think there should be a proper way to do this for android 6 and later versions. I think requesting runtime permissions needs to execute those kind of processess. This talks about the android permission requesting in runtime

提交回复
热议问题