Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intent to open Wi-Fi Direct settings

To open the WI-FI settings the code is:

startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));

To open the WI-FI Direct settings the code is ?

like image 895
seba123neo Avatar asked Aug 23 '16 21:08

seba123neo


1 Answers

Here's the manifest for that activity on KitKat,

    <activity android:name="Settings$WifiP2pSettingsActivity"
            android:taskAffinity="com.android.settings"
            android:parentActivityName="Settings$WifiSettingsActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.VOICE_LAUNCH" />
        </intent-filter>
        <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
            android:value="com.android.settings.wifi.p2p.WifiP2pSettings" />
        <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
            android:resource="@id/wireless_settings" />
    </activity>

So it doesn't look like they exposed an explicit intent. You may be able to start it via ComponentName but the name is not guaranteed to be the same across Android releases.

like image 84
Jeffrey Blattman Avatar answered Oct 05 '22 04:10

Jeffrey Blattman