How to force android 6 to automatically connect to a network without internet access?


Question

I've set up a hifiberry(raspberry + dac shield) in my car, which has a wireless access point. I'm using my old sony z3 compact as a headunit. Runeaudio allows you to do all this easily. However, the raspberry is just an access point, there is no modem so it has no internet access.



Normally the phone will connect to networks automatically, but inthis case, it says "no internet access, won't automatically connect" in the wifi options. I have to manually connect it every time.



Is there a way to make it connect automatically, even though there is no internet access?


Answer

As mentioned here since Android 5, when the device connect to. Wi-Fi network it makes a quick HTTP request to check if it has internet access.




This check is, for example, done with
clients3.google.com/generate_204 , a “webpage” that always returns
an HTTP status code 204 No Content| . Thus, if the device receives a
204` it is connected to the internet, otherwise it assumes that this
network does not provide proper internet access or is just a captive
portal.




Most probable resolution is to disable captive portal detection, ad there are a variety of ways to achieve this:




  1. Using AdAway to prevent the HTTP leak (blocking the URL)




    • Configuration of AdAway which blocks Google’s captive portal detection.




# captive portal



 127.0.0.1
clients3.google.com

127.0.0.1 clients.l.google.com



  1. Disable captive portal detection



With a rooted phone you can simply disable captive portal detection. Just get a root-shell through adb (or SSH etc) to run the following command:



settings put global captive_portal_detection_enabled 0


Additionally see this related question: How to disable captive portal detection? How to remove exclamation mark on Wi-Fi or signal icon in Lollipop?




  1. Change the server for captive portal detection using AdAway



    Another option for changing the captive portal detection server is to change its IP address to one that’s under your control.




You can do that with AdAway, for example. Let’s say your captive portal detection server has the IP address 5.189.140.231 , then you may add the following to your AdAway configuration:



5.189.140.231 clients3.google.com
5.189.140.231 clients.l.google.com


The webserver at 5.189.140.231 should then of course accept requests for the foreign domains.



For other workarounds see here


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes