0

I need to turn on wifi and I find a lot of tutorials, but my try is without success - eg. http://aspyct.org/blog/2013/05/04/android-switch-wifi-on-off/

Here are my permissions:

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application

And here is is code:

WifiManager wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);

    if(wifiManager.isWifiEnabled() == false)
    {
        try
        {
            wifiManager.setWifiEnabled(true);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

But I got this: java.lang.SecurityException: Package android does not belong to 10072

Darius Radius
  • 169
  • 3
  • 14
  • Duplicate? http://stackoverflow.com/questions/4162447/android-java-lang-securityexception-permission-denial-start-intent – Alberto Malagoli Nov 05 '15 at 09:53
  • The permissions look good at first glance. Might sound silly but try uninstalling and then re-installing your app. Sometimes permissions are a b*itch : http://mdzlog.alcor.net/2010/01/31/fix-broken-android-permissions-by-re-installing-apps/ – Narayan Acharya Nov 05 '15 at 10:02
  • Yes, youre right. Reinstall of app makes different UID, but still the bad. It looks, that problem is in the device. So thank you. – Darius Radius Nov 05 '15 at 10:22

2 Answers2

0

Thanks to Narayan. Problem is really in the permissons of system. I cannot to solve it, but I know, that problem is in the device. Thank you.

Darius Radius
  • 169
  • 3
  • 14
0

The error message seems to suggest a package/installation issue. Maybe this a rooted device or maybe the app was installed in some unconventional way?

Kaamel

Kaamel
  • 1,852
  • 1
  • 19
  • 25