У меня проблема с тем, что моя страница застревает на странице загрузки, просто на той странице, я думал, что это потому, что на ней не было включено javascript, затем добавил ее и добавил кучу другого кода, вероятно, я выиграл не нужно, но это было отбросить.
Есть идеи, в чем будет проблема?
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.WindowManager;
import android.webkit.GeolocationPermissions;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Obtain the WebSettings object//
WebSettings webSettings = browser.getSettings();
browser.setWebChromeClient(new WebChromeClient() {
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
// callback.invoke(String origin, boolean allow, boolean remember);
callback.invoke(origin, true, false);
}
});
browser.getSettings().setUseWideViewPort(true);
browser.getSettings().setLoadWithOverviewMode(true);
browser.getSettings().setDomStorageEnabled(true);
browser.clearView();
browser.setHorizontalScrollBarEnabled(false);
browser.getSettings().setAppCacheEnabled(true);
browser.getSettings().setDatabaseEnabled(true);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
browser.getSettings().setDatabasePath("/data/data/" + this.getPackageName() + "/databases/");
}
browser.setVerticalScrollBarEnabled(false);
browser.getSettings().setBuiltInZoomControls(true);
browser.getSettings().setDisplayZoomControls(false);
browser.getSettings().setAllowFileAccess(true);
browser.getSettings().setPluginState(WebSettings.PluginState.OFF);
browser.setScrollbarFadingEnabled(false);
browser.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
browser.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
browser.setWebViewClient(new WebViewClient());
browser.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
browser.setInitialScale(1);
browser.loadUrl("https://s167-es.ogame.gameforge.com/game/index.php?page=ingame&component=overview");
Toast.makeText(this, "Loading... Wait, please...",
Toast.LENGTH_LONG).show();
browser.setWebViewClient(new WebViewClient() {
// evita que los enlaces se abran fuera nuestra app en el navegador de android
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
}
}
Тогда в обычном браузере должно открыться новая вкладка с игрой, которая использует javascript на всякий случай, если это важно.
А вот представление исходного кода из предыдущего изображения: (в google chrome, но мои соображения, возможно, вы найдете что-то, что поможет вам определить, если я мне не хватает какого-то кода в веб-просмотре или что-то.
<!do ctype htm l><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=de vice-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="icon" href="/favicon.ico"><script type="text/javascript" src="/config/configuration.js"></script><title></title><link href="https://s3-static.geo.gfsrv.net/browsergamelobby/ogame/2.7.0/css/main.33ce9fb9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><div class="planet"></div><script type="text/javascript" src="https://s3-static.geo.gfsrv.net/browsergamelobby/ogame/2.7.0/js/main.b0b4a5d3.js"></scri pt></body></html>
Вот мой LOGCAT : 2020-02-07 02:45:31.362 21035-21035/? I/me.serverOctan: Not late-enabling -Xcheck:jni (already on)
2020-02-07 02:45:31.377 21035-21035/? E/me.serverOctan: Unknown bits set in runtime_flags: 0x8000
2020-02-07 02:45:31.384 21035-21035/? W/me.serverOctan: Unexpected CPU variant for X86 using defaults: x86
2020-02-07 02:45:31.518 21035-21070/? D/libEGL: Emulator has host GPU support, qemu.gles is set to 1.
2020-02-07 02:45:31.520 21035-21070/? W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
2020-02-07 02:45:31.507 21035-21035/? W/RenderThread: type=1400 audit(0.0:124): avc: denied { write } for name="property_service" dev="tmpfs" ino=7421 scontext=u:r:untrusted_app:s0:c142,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=OGame.serverOctans
2020-02-07 02:45:31.532 21035-21070/? D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2020-02-07 02:45:31.535 21035-21070/? D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2020-02-07 02:45:31.537 21035-21070/? D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2020-02-07 02:45:31.614 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2020-02-07 02:45:31.614 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2020-02-07 02:45:31.623 21035-21035/? I/WebViewFactory: Loading com.google.android.webview version 74.0.3729.185 (code 373018518)
2020-02-07 02:45:31.626 21035-21035/? I/me.serverOctan: The ClassLoaderContext is a special shared library.
2020-02-07 02:45:31.629 21035-21035/? I/me.serverOctan: The ClassLoaderContext is a special shared library.
2020-02-07 02:45:31.660 21035-21035/? I/cr_LibraryLoader: Time to load native libraries: 4 ms (timestamps 5821-5825)
2020-02-07 02:45:31.673 21035-21035/? I/chromium: [INFO:library_loader_hooks.cc(50)] Chromium logging enabled: level = 0, default verbosity = 0
2020-02-07 02:45:31.673 21035-21035/? I/cr_LibraryLoader: Expected native library version number "74.0.3729.185", actual native library version number "74.0.3729.185"
2020-02-07 02:45:31.678 21035-21075/? W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.google.android.webview, sandboxed = true
2020-02-07 02:45:31.683 21035-21075/? W/me.serverOctan: Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (greylist, reflection, allowed)
2020-02-07 02:45:31.688 21035-21035/? I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
2020-02-07 02:45:31.819 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;-><init>(Landroid/content/Context;I)V (greylist, reflection, allowed)
2020-02-07 02:45:31.819 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V (greylist, reflection, allowed)
2020-02-07 02:45:31.819 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (greylist, reflection, allowed)
2020-02-07 02:45:31.820 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(II)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (greylist, reflection, allowed)
2020-02-07 02:45:31.820 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (greylist, reflection, allowed)
2020-02-07 02:45:31.820 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelection;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (greylist, reflection, allowed)
2020-02-07 02:45:31.820 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (greylist, reflection, allowed)
2020-02-07 02:45:31.820 21035-21035/? W/me.serverOctan: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (greylist, reflection, allowed)
2020-02-07 02:45:31.851 21035-21111/? D/HostConnection: HostConnection::get() New Host Connection established 0xe1a3fd20, tid 21111
2020-02-07 02:45:31.858 21035-21111/? D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1
2020-02-07 02:45:31.864 21035-21103/? W/cr_media: Requires BLUETOOTH permission
2020-02-07 02:45:31.887 21035-21111/? D/EGL_emulation: eglCreateContext: 0xe1a1baa0: maj 3 min 1 rcv 4
2020-02-07 02:45:31.890 21035-21111/? D/EGL_emulation: eglMakeCurrent: 0xe1a1baa0: ver 3 1 (tinfo 0xe1a0fec0)
2020-02-07 02:45:31.893 21035-21111/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
2020-02-07 02:45:31.893 21035-21111/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
2020-02-07 02:45:31.976 21035-21068/? D/HostConnection: HostConnection::get() New Host Connection established 0xde52daa0, tid 21068
2020-02-07 02:45:31.977 21035-21068/? D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1
2020-02-07 02:45:31.977 21035-21068/? W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2020-02-07 02:45:31.993 21035-21111/? I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
2020-02-07 02:45:31.996 21035-21111/? W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
2020-02-07 02:45:32.011 21035-21068/? D/EGL_emulation: eglCreateContext: 0xebb10080: maj 3 min 1 rcv 4
2020-02-07 02:45:32.020 21035-21068/? D/EGL_emulation: eglMakeCurrent: 0xebb10080: ver 3 1 (tinfo 0xca674190)
2020-02-07 02:45:32.036 21035-21068/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
2020-02-07 02:45:32.036 21035-21068/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
2020-02-07 02:45:32.036 21035-21111/? D/EGL_emulation: eglCreateContext: 0xe1a1ca60: maj 3 min 0 rcv 3
2020-02-07 02:45:32.038 21035-21111/? D/EGL_emulation: eglMakeCurrent: 0xe1a1ca60: ver 3 0 (tinfo 0xe1a0fec0)
2020-02-07 02:45:32.050 21035-21111/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:32.050 21035-21111/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:32.079 21035-21068/? W/Gralloc3: mapper 3.x is not supported
2020-02-07 02:45:32.083 21035-21068/? D/HostConnection: createUnique: call
2020-02-07 02:45:32.084 21035-21068/? D/HostConnection: HostConnection::get() New Host Connection established 0xca9745b0, tid 21068
2020-02-07 02:45:32.085 21035-21068/? D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1
2020-02-07 02:45:32.086 21035-21068/? D/eglCodecCommon: allocate: Ask for block of size 0x1000
2020-02-07 02:45:32.086 21035-21068/? D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3ff740000 size 0x2000
2020-02-07 02:45:32.102 21035-21068/? D/EGL_emulation: eglMakeCurrent: 0xebb10080: ver 3 1 (tinfo 0xca674190)
2020-02-07 02:45:32.156 21035-21111/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:32.157 21035-21111/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:32.160 21035-21068/? D/EGL_emulation: eglMakeCurrent: 0xebb10080: ver 3 1 (tinfo 0xca674190)
2020-02-07 02:45:32.198 21035-21068/? D/EGL_emulation: eglMakeCurrent: 0xebb10080: ver 3 1 (tinfo 0xca674190)
2020-02-07 02:45:32.414 21035-21090/OGame.serverOctans D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2020-02-07 02:45:34.074 21035-21068/OGame.serverOctans E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:34.074 21035-21068/OGame.serverOctans E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:34.643 21035-21111/OGame.serverOctans E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:34.646 21035-21111/OGame.serverOctans I/chatty: uid=10142(OGame.serverOctans) Chrome_InProcGp identical 2 lines
2020-02-07 02:45:34.646 21035-21111/OGame.serverOctans E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
2020-02-07 02:45:37.285 21035-21091/OGame.serverOctans W/chromium: [WARNING:spdy_session.cc(3232)] Received HEADERS for invalid stream 23