aframe icon indicating copy to clipboard operation
aframe copied to clipboard

Android Webview issue

Open kyriakosproto opened this issue 9 years ago • 5 comments

Hello,

We experience an issue when we preview aframe scenes through Webview in Android apps after Chrome/Webview update to version 62.0 (was working fine on previous versions). The aframe scene initializes and works fine but it does not respond to the device movements (seems like it doesn't communicate with gyroscope to update vr camera's rotation), although rotation using touch events works fine.

We have this problem embedding our project, that uses aframe version 0.5, also had the same result when we tried to embed examples from aframe's website (including https://aframe.io/examples/showcase/helloworld/ which uses version 0.7)

The following permissions/features are defined in AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.sensor.gyroscope" />

Here is a snippet of the webview initialization code from the Activity class file

WebView webView = (WebView) findViewById(R.id.webview);
       WebSettings webSettings = webView.getSettings();
       webSettings.setJavaScriptEnabled(true);
       webSettings.setBuiltInZoomControls(true);
       webSettings.setAllowContentAccess(true);
       webSettings.setAllowFileAccess(true);
       webSettings.setAllowFileAccessFromFileURLs(true);
       webSettings.setAllowUniversalAccessFromFileURLs(true);
       webSettings.setAppCacheEnabled(true);
       webSettings.setBlockNetworkImage(false);
       webSettings.setBlockNetworkLoads(false);
       webSettings.setDatabaseEnabled(true);
       webSettings.setDomStorageEnabled(true);
       webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
       webSettings.setLoadsImagesAutomatically(true);
       webSettings.setSupportZoom(true);
webView.loadUrl("https://aframe.io/examples/showcase/helloworld/");

Following are the contents of the build.gradle file

apply plugin: 'com.android.application'

android {
   compileSdkVersion 25
   buildToolsVersion "25.0.3"
   defaultConfig {
       applicationId "xxxxxxx"
       minSdkVersion 16
       targetSdkVersion 25
       versionCode 1
       versionName "1.0"
       testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
   }
   buildTypes {
       release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
       }
   }
}

dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
   androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
       exclude group: 'com.android.support', module: 'support-annotations'
   })
   compile 'com.android.support:appcompat-v7:25.3.1'
   compile 'com.android.support.constraint:constraint-layout:1.0.2'
   compile 'com.android.support:design:25.3.1'
   testCompile 'junit:junit:4.12'
}

we tested this on 2 Android devices:

  • A-Frame Version: 0.5, 0.7
  • Platform / Device:
  1. Nexus 5 with Android version 6.0.1 and System Webview 62.0.3202.84
  2. Google Pixel with Android version 8.0.0 and Chrome version 62.0.3202.84

Does anyone else have this issue? or knows if there is a fix for that?

kyriakosproto avatar Nov 20 '17 10:11 kyriakosproto

Issue is specific to Android System WebView 62.x or a WebView using Chrome 62.x. It's resolved in Chrome 63, 11 days away from release. We've bundled the CrossWalk WebView with our app and are conditionally using it when we detect the user has 62.x installed.

zgeoff avatar Nov 24 '17 04:11 zgeoff

Chrome 63 should have shipped. @meatwallace @kyriakosproto Can you confirm if this issue is gone?

dmarcos avatar Dec 17 '17 10:12 dmarcos

@dmarcos - definitely resolved in Chrome 63.

zgeoff avatar Dec 20 '17 03:12 zgeoff

Cool, thanks!

dmarcos avatar Dec 20 '17 12:12 dmarcos

Сайт должен начинаться с https, тогда будет работать.

jhfrek avatar Feb 09 '20 17:02 jhfrek