Search code examples
androidwifinook

How to open wifi settings on Nook/NookColor


My app needs active wifi connection. I added button "Go to wifi settings" with this code

Intent settings = new Intent(Settings.ACTION_WIFI_SETTINGS);
settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(settings);

It is works perfect on 95% of devices. But on Nook color I have error

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.WIFI_SETTINGS flg=0x10000000 }

How to open wifi settings on Nook/Nook color?


Solution

  • Summary:
    1-Find desired activity's complete name in Nook.
    2-Set your intent classname with it.
    3-Start your intent.
    Details:
    1-a:Connect your device to PC that you are developing your project.
    1-b:Open Hierarchy view perspective of eclipse and then open Windows in that perspective.
    1-c:Open your desired Activity manually in device.(home -> setting -> ...)
    1-d:It may be need to do refresh on Windows in perspective.
    1-e:All existing Activities with their complete name and package name must be seen in Windows in Hierarchy view perspective.
    enter image description here
    For example,here my desired activity name is:com.android.settings.WirelessSettings and it's package name is com.android.settings.

    I hope this snippet code help you to continue:

    b1 = (Button) findViewById(R.id.button1);
    b1.setOnClickListener(new OnClickListener() {
    
        @Override
        public void onClick(View v) {
            Intent i = new Intent();
            i.setClassName("com.android.settings",
            "com.android.settings.WirelessSettings");
            startActivity(i);
        }
    });
    

    For more details on Calling App from another you can see this questions: Q1 - Q2