'Unsupported browser' when accessing router page

Issue

Today, I wanted to make an app that accesses the router’s web page to make managing it easier. However, my router said that the web browser that I’m using is unsupported.

Here’s the activity:

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private WebView webView;
    private TextView textView;



    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        webView = findViewById(R.id.webView);
        webView.loadUrl("192.168.1.1");
        webView.setWebViewClient(new WebViewClient() {

            //API Level under 24
            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String url){
                return false;
            }

            //API Level over 24
            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest request) {
                return false;
            }
        });


        urlBar();
        debugFinish();
    }


    public void debugFinish() {
        Log.d("MyApplication", "Finishing in 5 seconds.");
        new Handler().postDelayed(() -> Log.d("MyApplication", "Finishing in 4 seconds."),1000);
        new Handler().postDelayed(() -> Log.d("MyApplication", "Finishing in 3 seconds."),2000);
        new Handler().postDelayed(() -> Log.d("MyApplication", "Finishing in 2 seconds."),3000);
        new Handler().postDelayed(() -> Log.d("MyApplication", "Finishing in 1 second."),4000);
        new Handler().postDelayed(() -> {
            Log.d("MyApplication", "Finished.");
            finish();
        },5000);
    }

    public void urlBar() {
        new Handler().postDelayed(() -> {
            String webUrl = webView.getUrl();
            textView = findViewById(R.id.text);
            textView.setText(webUrl);
            urlBar();
        },100);
    }

    @Override
    public void onBackPressed() {
        if (webView.canGoBack()) {
            webView.goBack();
        } else {
            super.onBackPressed();
        }
    }
}

And here are the logs for the latest session:

08/23 18:19:57: Launching 'app' on samsung SM-A528B.
Install successfully finished in 325 ms.
$ adb shell am start -n "com.censored.censored/com.censored.censored.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.censored.censored
Connected to process 24423 on device 'samsung-sm_a528b-R5CT30H5DXE'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
V/studio.deploy: Startup agent attached to VM
V/studio.deploy: No existing instrumentation found. Loading instrumentation from instruments-1f2f27f8.jar
W/outerpageacces: DexFile /data/data/com.censored.censored/code_cache/.studio/instruments-1f2f27f8.jar is in boot class path but is not in a known location
V/studio.deploy: Applying transforms with cached classes
W/outerpageacces: Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled.
W/outerpageacces: Redefining intrinsic method boolean java.lang.Thread.interrupted(). This may cause the unexpected use of the original definition of boolean java.lang.Thread.interrupted()in methods that have already been compiled.
D/ActivityThread: handleBindApplication()++ app=com.censored.censored
D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10759; state: ENABLED
W/ActivityThread: Application com.censored.censored is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
Connecting to com.censored.censored
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
V/studio.deploy: Startup agent attached to VM
V/studio.deploy: No existing instrumentation found. Loading instrumentation from instruments-1f2f27f8.jar
W/outerpageacces: DexFile /data/data/com.censored.censored/code_cache/.studio/instruments-1f2f27f8.jar is in boot class path but is not in a known location
V/studio.deploy: Applying transforms with cached classes
W/outerpageacces: Redefining intrinsic method java.lang.Thread java.lang.Thread.currentThread(). This may cause the unexpected use of the original definition of java.lang.Thread java.lang.Thread.currentThread()in methods that have already been compiled.
W/outerpageacces: Redefining intrinsic method boolean java.lang.Thread.interrupted(). This may cause the unexpected use of the original definition of boolean java.lang.Thread.interrupted()in methods that have already been compiled.
D/ActivityThread: handleBindApplication()++ app=com.censored.censored
D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10759; state: ENABLED
W/ActivityThread: Application com.censored.censored is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:59305', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1429)
W/ActivityThread: Slow operation: 2612ms so far, now at handleBindApplication: Before HardwareRenderer
W/ActivityThread: Slow operation: 2621ms so far, now at handleBindApplication: After HardwareRenderer
W/ziparchive: Unable to open '/data/data/com.censored.censored/code_cache/.overlay/base.apk/classes3.dm': No such file or directory
W/ziparchive: Unable to open '/data/app/~~as9uWR63HKmuwYZvqPYU3Q==/com.censored.censored-0ouQJlouEDKWFYvo3am4mg==/base.dm': No such file or directory
W/ziparchive: Unable to open '/data/app/~~as9uWR63HKmuwYZvqPYU3Q==/com.censored.censored-0ouQJlouEDKWFYvo3am4mg==/base.dm': No such file or directory
V/GraphicsEnvironment: ANGLE Developer option for 'com.censored.censored' set to: 'default'
V/GraphicsEnvironment: Updatable production driver is not supported on the device.
D/LoadedApk: LoadedApk::makeApplication() appContext.mOpPackageName=com.censored.censored appContext.mBasePackageName=com.censored.censored
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/ActivityThread: handleBindApplication() --
D/OpenGLRenderer: RenderThread::requireGlContext()
I/AdrenoGLES-0: QUALCOMM build                   : cac6e6f805, I5187d04b75
    Build Date                       : 11/22/21
    OpenGL ES Shader Compiler Version: EV031.35.01.10
    Local Branch                     : 
    Remote Branch                    : 
    Remote Branch                    : 
    Reconstruct Branch               : 
I/AdrenoGLES-0: Build Config                     : S P 10.0.7 AArch64
I/AdrenoGLES-0: Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
I/AdrenoGLES-0: PFP: 0x016dc094, ME: 0x00000000
D/OpenGLRenderer: RenderThread::setGrContext()
I/DecorView: [INFO] isPopOver=false, config=true
I/DecorView: updateCaptionType >> [email protected][], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false
D/DecorView: setCaptionType = 0, this = [email protected][]
I/DecorView: getCurrentDensityDpi: from real metrics. densityDpi=450 msg=resources_loaded
W/outerpageacces: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
W/outerpageacces: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
W/ziparchive: Unable to open '/data/app/~~YgYDZv4GpC9wYpwxXiO9DA==/com.google.android.trichromelibrary.dev_524300233-fAGblpk31Yjy1vkpqWEHyA==/base.dm': No such file or directory
W/ziparchive: Unable to open '/data/app/~~YgYDZv4GpC9wYpwxXiO9DA==/com.google.android.trichromelibrary.dev_524300233-fAGblpk31Yjy1vkpqWEHyA==/base.dm': No such file or directory
W/outerpageacces: Entry not found
I/WebViewFactory: Loading com.google.android.webview.dev version 106.0.5243.2 (code 524300233)
W/outerpageacces: Accessing hidden method Landroid/os/Trace;->isTagEnabled(J)Z (unsupported, reflection, allowed)
W/outerpageacces: Accessing hidden method Landroid/os/Trace;->traceBegin(JLjava/lang/String;)V (unsupported, reflection, allowed)
W/outerpageacces: Accessing hidden method Landroid/os/Trace;->traceEnd(J)V (unsupported, reflection, allowed)
W/outerpageacces: Accessing hidden method Landroid/os/Trace;->asyncTraceBegin(JLjava/lang/String;I)V (unsupported, reflection, allowed)
W/outerpageacces: Accessing hidden method Landroid/os/Trace;->asyncTraceEnd(JLjava/lang/String;I)V (unsupported, reflection, allowed)
I/cr_WVCFactoryProvider: Loaded version=106.0.5243.2 minSdkVersion=29 isBundle=true multiprocess=true packageId=2
I/cr_LibraryLoader: Successfully loaded native library
I/cr_CachingUmaRecorder: Flushed 9 samples from 9 histograms.
E/SchedPolicy: Failed to find cgroup for tid 24423
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/snapshot_blob_32.bin': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/snapshot_blob_64.bin': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/icudtl.dat': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/chrome_100_percent.pak': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/stored-locales/en-US.pak': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/stored-locales/en-US.pak': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/stored-locales/en-US.pak': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/resources.pak': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/stored-locales/en-US.pak': No such file or directory
W/chromium: [WARNING:dns_config_service_android.cc(115)] Failed to read DnsConfig.
D/CompatibilityChangeReporter: Compat change id reported: 171228096; UID 10759; state: ENABLED
W/outerpageacces: Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (unsupported, reflection, allowed)
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/snapshot_blob_32.bin': No such file or directory
E/outerpageacces: Failed to open file '/data/data/com.censored.censored/code_cache/.overlay/base.apk/assets/snapshot_blob_64.bin': No such file or directory
W/cr_media: BLUETOOTH_CONNECT permission is missing.
W/cr_media: registerBluetoothIntentsIfNeeded: Requires BLUETOOTH permission
D/MyApplication: Finishing in 5 seconds.
D/NativeCustomFrequencyManager: [NativeCFMS] BpCustomFrequencyManager::BpCustomFrequencyManager()
I/DecorView: notifyKeepScreenOnChanged: keepScreenOn=true
I/[email protected][MainActivity]: setView = [email protected] TM=true
I/[email protected][MainActivity]: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)0 dur=6 res=0x7 s={true -5476376616297765184} ch=true fn=-1
I/[email protected][MainActivity]: [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:11420 android.view.ViewRootImpl.performTraversals:4193 android.view.ViewRootImpl.doTraversal:2919 
D/[email protected][MainActivity]: Creating frameDrawingCallback nextDrawUseBlastSync=false reportNextDraw=true hasBlurUpdates=false
D/[email protected][MainActivity]: Creating frameCompleteCallback
D/OpenGLRenderer: eglCreateWindowSurface
D/View[email protected][MainActivity]: Received frameDrawingCallback frameNum=1. Creating transactionCompleteCallback=false
I/BufferQueueProducer: [[email protected][MainActivity]#0(BLAST Consumer)0](id:5f6700000000,api:1,p:24423,c:24423) queueBuffer: queued for the first time.
D/OpenGLRenderer: GPIS:: SetUp Pid : 24423    Tid : 24468
D/[email protected][MainActivity]: Received frameCompleteCallback  lastAcquiredFrameNum=1 lastAttemptedDrawFrameNum=1
I/[email protected][MainActivity]: [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$addFrameCompleteCallbackIfNeeded$3$ViewRootImpl:4995 android.view.ViewRootImpl$$ExternalSyntheticLambda16.run:6 android.os.Handler.handleCallback:938 
I/[email protected][MainActivity]: [DP] rdf()
D/[email protected][MainActivity]: reportDrawFinished (fn: -1) 
D/InsetsSourceConsumer: ensureControlAlpha: for ITYPE_NAVIGATION_BAR on com.censored.censored/com.censored.censored.MainActivity
D/InsetsSourceConsumer: ensureControlAlpha: for ITYPE_STATUS_BAR on com.censored.censored/com.censored.censored.MainActivity
I/[email protected][MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputMethodManager: startInputInner - Id : 0
D/MyApplication: Finishing in 4 seconds.
D/MyApplication: Finishing in 3 seconds.
D/MyApplication: Finishing in 2 seconds.
D/MyApplication: Finishing in 1 second.
I/outerpageacces: Compiler allocated 4564KB to compile void android.view.ViewRootImpl.performTraversals()
D/MyApplication: Finished.
I/[email protected][MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputTransport: Input channel destroyed: 'ClientS', fd=214
I/[email protected][MainActivity]: handleAppVisibility mAppVisible=true visible=false
D/OpenGLRenderer: setSurface called with nullptr
D/OpenGLRenderer: setSurface() destroyed EGLSurface
D/OpenGLRenderer: destroyEglSurface
I/[email protected][MainActivity]: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)8 dur=8 res=0x5 s={false 0} ch=true fn=55
I/[email protected][MainActivity]: stopped(true) old=false
D/OpenGLRenderer: setSurface called with nullptr
I/[email protected][MainActivity]: dispatchDetachedFromWindow
D/InputTransport: Input channel destroyed: '3e2bfbb', fd=175
D/OpenGLRenderer: setSurface called with nullptr
W/System: A resource failed to call close. 

In case you are wondering: yes. The page opens just fine in the Chrome app on my phone.

Solution

WebSettings.setDomStorageEnabled(true);

This did the trick

Answered By – MASAN

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published