Wi‑Fi Direct lets two Android devices communicate directly over Wi‑Fi without a router. By default the group created for a transfer disappears as soon as the session ends, which means you have to recreate it each time you want to share files. This tutorial shows you how to make that group persistent using only ADB commands – no rooting, no extra apps, and no constant re‑pairing.
Settings → About phone.Build number seven times until you see the message “You are now a developer”.System → Developer options (the path may differ on Samsung – Settings → Developer options directly).Why this matters: ADB needs the debugging flag to accept commands from your PC. Without it the device will ignore every adb request.
C:\adb or ~/adb).adb version – you should see something like Android Debug Bridge version 1.0.41.If the command is not recognized, add the folder to your system PATH or always run it from the folder directly.
adb devices. The output should list a device serial number followed by device.
List of devices attached
0123456789ABCDEF device
If the device shows as unauthorized, re‑grant the permission on the phone.
Android provides a hidden cmd wifi interface that can start a Wi‑Fi Direct group. The command works on stock Android and on most OEM skins, though the exact syntax may vary slightly between versions.
adb shell cmd wifi p2p create-group
adb shell dumpsys wifi_p2p
Look for a line similar to Group Owner: true and an SSID like DIRECT-xx-MyPhone.Why we use the cmd wifi p2p interface: It bypasses the UI and creates the group directly, which is necessary for persisting the group later.
Android stores the persistence flag in the global settings database. Setting this flag tells the Wi‑Fi stack to keep the group alive after a reboot.
adb shell settings put global wifi_p2p_persistent 1
adb shell settings put global wifi_p2p_ssid "MyDirectGroup"
adb shell settings put global wifi_p2p_passphrase "StrongPass123"
These keys are read the next time the system restores the group.
adb reboot
adb shell dumpsys wifi_p2p again. You should still see the group listed and the SSID you set.
Note: Some OEMs (e.g., certain Xiaomi or Huawei ROMs) disable the global setting for security reasons. If the group disappears after reboot, the device simply does not support persistent groups without rooting.
With the group running, any Android device that supports Wi‑Fi Direct can join it. The built‑in file manager makes the process straightforward.
Settings → Connections → Wi‑Fi Direct (the exact path may differ).MyDirectGroup) and enter the passphrase if prompted.Wi‑Fi Direct as the target.
Because the group is persistent, you can repeat step 6 any time without recreating the group.
adb shell am start -n com.android.settings/.wifi.p2p.WifiP2pSettingsActivity opens the Wi‑Fi Direct settings screen. From there you can manually tap “Create group”. The persistence flag set in Step 5 will keep the group alive after you leave the screen.adb shell am broadcast -a android.net.wifi.p2p.action.CREATE_GROUP triggers the same internal service. Some custom ROMs listen for this broadcast while others ignore it.Problem: The group disappears after a reboot.
Cause: The device’s firmware disables the wifi_p2p_persistent setting.
Solution: Verify the setting after reboot with adb shell settings get global wifi_p2p_persistent. If it returns 0, the ROM blocks persistence. In that case you can keep the group alive by launching a tiny background script that re‑creates it on boot (requires a Tasker profile, which is beyond the scope of a no‑root tutorial).
Problem: The second device cannot see the group.
Cause: Wi‑Fi Direct on some devices defaults to the 5 GHz band, while older devices only support 2.4 GHz.
Solution: Force the group to use 2.4 GHz by adding the setting:
adb shell settings put global wifi_p2p_band 2
Re‑create the group after applying the change.
Security warning: A persistent Wi‑Fi Direct group behaves like an always‑on hotspot. Anyone within range who knows the SSID and passphrase can connect. Choose a strong passphrase and avoid using the default “direct‑xxxx” SSID in public places.
adb shell dumpsys wifi_p2p – the group should be listed with persistent: true.If you travel frequently and use public Wi‑Fi, keeping a permanent Wi‑Fi Direct hotspot can expose your device to unwanted connections. In such cases, create a temporary group only when you need to transfer files and delete it afterward with adb shell cmd wifi p2p delete-group.
By following the steps above you have turned your Android phone into a stable Wi‑Fi Direct hub that survives reboots, letting you share files instantly with any compatible device. The method relies only on ADB, works on stock Android, and leaves your device unrooted, preserving warranty and security.
Remember to keep the SSID and passphrase private, and revisit the persistence flag after major OS updates – manufacturers sometimes reset hidden settings. With a persistent group in place, file‑sharing becomes a frictionless part of your daily workflow.









