Search Unity

[SOLVED] Android app does not launch "Choose an Action" picker

Discussion in 'Android' started by Christin2015, Apr 25, 2019.

  1. Christin2015

    Christin2015

    Joined:
    Dec 1, 2015
    Posts:
    48
    Hi all,

    I want to build an Android app that displays a web page in a WebView. This web page I have to load has a form. The form launches an Intent for "choose an Action". The user can either start the file picker so that the user can choose a pic from the photo gallery or launch the camera to take a photo. In both cases the photo is then uploaded to a server which is handled properly by the web page. (BTW, I am not the developer of this web page)

    This works fine in the iOS app built with Unity. It also works fine in the mobile Chrome browser on Android, the "Choose an action" screen is launched. But, it is not launched in the Android app built with Unity, instead the logcat has logs of the accelerometer (see the screenshot from Unity's Console, and the logcat from Android Studio)

    I added permissions to the manifest that is attached. Now, I do not know where to look and why the "Choose Action" Intent does not start in my Android app built with Unity 2018.3.13
    (For the WebView I am using the asset by UniWebView.)

    I would appreciate any hints. Thank you in advance!


    The manifest generated by Unity:

    Code (JavaScript):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity.myapp" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
    3.   <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    4.   <application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name">
    5.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
    6.       <intent-filter>
    7.         <action android:name="android.intent.action.MAIN" />
    8.         <category android:name="android.intent.category.LAUNCHER" />
    9.         <action android:name="android.intent.action.GET_CONTENT" />
    10.         <category android:name="android.intent.category.OPENABLE" />
    11.         <category android:name="android.intent.category.DEFAULT" />
    12.         <data android:mimeType="image/*" />
    13.         <data android:mimeType="video/*" />
    14.       </intent-filter>
    15.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    16.     </activity>
    17.     <!--Image file chooser activity for UniWebView-->
    18.     <activity android:name="com.onevcat.uniwebview.UniWebViewFileChooserActivity" />
    19.     <meta-data android:name="unity.build-id" android:value="558c3b2e-86bd-47f7-bf86-8946952c062f" />
    20.     <meta-data android:name="unity.splash-mode" android:value="0" />
    21.     <meta-data android:name="unity.splash-enable" android:value="True" />
    22.   </application>
    23.   <uses-permission android:name="android.permission.CAMERA" />
    24.   <uses-feature android:glEsVersion="0x00020000" />
    25.   <uses-permission android:name="android.permission.INTERNET" />
    26.   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
    27.   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
    28.   <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    29.   <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
    30.   <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
    31. </manifest>
    The logcat after clicking in the form, which should launch the action chooser:
     
  2. Christin2015

    Christin2015

    Joined:
    Dec 1, 2015
    Posts:
    48
    Problem solved thanks to Wang Wei from UniWebView Asset. I had to switch the "Write Permission" to "External (SDCard)" in the Player Settings Panel.