Use a local-only Wi-Fi hotspot
Stay organized with collections
Save and categorize content based on your preferences.
You can use a local-only hotspot to enable applications on devices connected to
the Wi-Fi hotspot to communicate with each other. The network created by this
method will not have Internet access. Each application can make a single request
for the hotspot, but multiple applications can request the hotspot at the same
time. When multiple applications have successfully registered concurrently, they
share the underlying hotspot.
LocalOnlyHotspotCallback.onStarted(LocalOnlyHotspotReservation)
is called when the hotspot is ready for use.
If your app targets Android 13 (API level 33) or higher, you must request the
NEARBY_WIFI_DEVICES
to use a local-only hotspot, as shown in the following code snippet. Apps that
target an earlier version of Android must request ACCESS_FINE_LOCATION
instead.
<manifest ...>
<<!-- If your app targets Android 13 (API level 33)
or higher, you must declare the NEARBY_WIFI_DEVICES permission. -->
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES"
<!-- If your app derives location information from
Wi-Fi APIs, don't include the "usesPermissionFlags"
attribute. -->
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
<!-- If any feature in your app relies on
precise location information, don't include the
"maxSdkVersion" attribute. -->
android:maxSdkVersion="32" />
<application ...>
...
</application>
</manifest>
For more details on using local-only hotspots, see
startLocalOnlyHotspot()
.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[],[],null,["You can use a local-only hotspot to enable applications on devices connected to\nthe Wi-Fi hotspot to communicate with each other. The network created by this\nmethod will not have Internet access. Each application can make a single request\nfor the hotspot, but multiple applications can request the hotspot at the same\ntime. When multiple applications have successfully registered concurrently, they\nshare the underlying hotspot.\n[`LocalOnlyHotspotCallback.onStarted(LocalOnlyHotspotReservation)`](/reference/android/net/wifi/WifiManager.LocalOnlyHotspotCallback#onStarted(android.net.wifi.WifiManager.LocalOnlyHotspotReservation))\nis called when the hotspot is ready for use.\n\nIf your app targets Android 13 (API level 33) or higher, you must request the\n[`NEARBY_WIFI_DEVICES`](/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES)\nto use a local-only hotspot, as shown in the following code snippet. Apps that\ntarget an earlier version of Android must request `ACCESS_FINE_LOCATION`\ninstead. \n\n```xml\n\u003cmanifest ...\u003e\n \u003c\u003c!-- If your app targets Android 13 (API level 33)\n or higher, you must declare the NEARBY_WIFI_DEVICES permission. --\u003e\n \u003cuses-permission android:name=\"android.permission.NEARBY_WIFI_DEVICES\"\n \u003c!-- If your app derives location information from\n Wi-Fi APIs, don't include the \"usesPermissionFlags\"\n attribute. --\u003e\n android:usesPermissionFlags=\"neverForLocation\" /\u003e\n \u003cuses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"\n \u003c!-- If any feature in your app relies on\n precise location information, don't include the\n \"maxSdkVersion\" attribute. --\u003e\n android:maxSdkVersion=\"32\" /\u003e\n \u003capplication ...\u003e\n ...\n \u003c/application\u003e\n\u003c/manifest\u003e\n```\n\nFor more details on using local-only hotspots, see\n[`startLocalOnlyHotspot()`](/reference/android/net/wifi/WifiManager#startLocalOnlyHotspot(android.net.wifi.WifiManager.LocalOnlyHotspotCallback,%20android.os.Handler))."]]