Skip to content

Import files to web page #591

Open
Open

Description

@developvsn

Hello. I’m trying to upload some photos or files/documents on page loaded in web view, i read old closed issues but didn’t find final answer about this topic. Can we open “choose action” picker on android depending on web page or there is no ways to perform it ? Thanks in advance

Activity

  1. KojiNakamaru commented on Sep 15, 2020

    @KojiNakamaru
    Member

    The current versions supports the file input field on Android, please check the top of https://github.com/gree/unity-webview/tree/8e7e576949536a4d5e127bc1d46e99060523bcbd#android .

  2. Blindsp0t-creative commented on Oct 28, 2020

    @Blindsp0t-creative

    Hi there !!

    First of all thank you for the amazing work on this.

    I'm facing the same issue here, i tried both versions (with and without Fragment). When i browse a page with a button to upload a file, and click on it, nothing happens...
    No window to pick a file, or anything.

    Any idea what i'm doing wrong?

    I'm building an Android app, and test with Android 5.1.1 and another device running Android 8.0.0

    Thanks in advance

  3. KojiNakamaru commented on Oct 29, 2020

    @KojiNakamaru
    Member

    I tested the sample app with dist/unity-webview.zip and confirmed it worked. My environment is:

    • Unity 2019.4.13f1
    • Vankyo S7 (Android 9.0)

    The sample app contains <input type="file" name="datafile"/> at the bottom of the page. If you didn't run the sample app, could you please test it?

  4. Blindsp0t-creative commented on Nov 2, 2020

    @Blindsp0t-creative

    Thank you very much for the quick answer.

    I built an entire new Unity project, and tested with the /dist/unity-webview.zip and can confirm it works !!!

    Don't know if it was due to my previous project settings or the version of the unitypackage i was using before...

    Thank you again !

  5. wantsliveforever commented on Jun 25, 2021

    @wantsliveforever

    Hello! Unfortunately, the input file does not work on Android. On iOS works fine. I'm trying to upload an image to the site at https://mirkoda.com/Identity/Account/Login I didn't dig into the code CWebViewPlugin.java. I looked, there are already changes related to the link a1a2a89 But not all

  6. wantsliveforever commented on Jun 26, 2021

    @wantsliveforever

    This is a part of log from Samsung S8+. I clicking to input file.

    06-26 17:40:34.353 5505 5690 D WifiNotificationController: clearPendingNotification with resetRepeatTime= true, state= 0
    06-26 17:40:34.459 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:34.660 7615 7615 I chatty : uid=10168(com.sec.android.inputmethod) identical 1 line
    06-26 17:40:34.861 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:34.981 5505 5663 D InputReader: Input event(8): value=1 when=70655.138172
    06-26 17:40:34.981 5505 5663 D InputReader: Input event(8): value=1 when=70655.138172
    06-26 17:40:34.981 5505 5663 I InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.1687 ] when=70655.138172
    06-26 17:40:34.982 5505 5662 I InputDispatcher: Delivering touch to (31394): action: 0x0, displayId: 0, '34ffdb9', toolType: 1
    06-26 17:40:34.982 31394 31394 D ViewRootImpl@5166214[UnityPlayerActivity]: ViewPostIme pointer 0
    06-26 17:40:35.061 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:35.098 5505 5663 D InputReader: Input event(8): value=0 when=70655.255494
    06-26 17:40:35.099 5505 5663 D InputReader: Input event(8): value=0 when=70655.255494
    06-26 17:40:35.099 5505 5663 I InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=70655.255494
    06-26 17:40:35.099 5505 5662 I InputDispatcher: Delivering touch to (31394): action: 0x1, displayId: 0, '34ffdb9', toolType: 1
    06-26 17:40:35.100 31394 31394 D ViewRootImpl@5166214[UnityPlayerActivity]: ViewPostIme pointer 1
    06-26 17:40:35.125 31394 31394 D InputMethodManager: HSIFW - flag : 0 Pid : 31394
    06-26 17:40:35.126 5505 7118 V InputMethodManagerService: Client requesting input be hidden, flags : 0
    06-26 17:40:35.126 5505 7118 V InputMethodManagerService: hideCurrentInputLocked : shouldHideSoftInput is false
    06-26 17:40:35.262 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:35.302 13661 20884 I BCL@Common: (ProvisionProvider) query, content://com.samsung.android.bixby.agent.common.provision/service_id
    06-26 17:40:35.308 7200 13733 D BWU@VoiceWakeupInfo: getBixbyServiceID :
    06-26 17:40:35.308 7200 13733 I SamsungAnalyticsUtil: :Ph::SamsungAnalytics can't setConfiguration because serviceId is empty after 68018000
    06-26 17:40:35.463 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:35.865 7615 7615 I chatty : uid=10168(com.sec.android.inputmethod) identical 2 lines
    06-26 17:40:36.065 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:36.125 5505 5663 D InputReader: Input event(8): value=1 when=70656.281711
    06-26 17:40:36.125 5505 5663 D InputReader: Input event(8): value=1 when=70656.281711
    06-26 17:40:36.125 5505 5663 I InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.1688 ] when=70656.281711
    06-26 17:40:36.125 5505 5662 I InputDispatcher: Delivering touch to (31394): action: 0x0, displayId: 0, '34ffdb9', toolType: 1
    06-26 17:40:36.126 31394 31394 D ViewRootImpl@5166214[UnityPlayerActivity]: ViewPostIme pointer 0
    06-26 17:40:36.252 5505 5663 D InputReader: Input event(8): value=0 when=70656.408806
    06-26 17:40:36.252 5505 5663 D InputReader: Input event(8): value=0 when=70656.408806
    06-26 17:40:36.252 5505 5663 I InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=70656.408806
    06-26 17:40:36.252 5505 5662 I InputDispatcher: Delivering touch to (31394): action: 0x1, displayId: 0, '34ffdb9', toolType: 1
    06-26 17:40:36.254 31394 31394 D ViewRootImpl@5166214[UnityPlayerActivity]: ViewPostIme pointer 1
    06-26 17:40:36.266 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:36.282 31394 31394 D InputMethodManager: HSIFW - flag : 0 Pid : 31394
    06-26 17:40:36.282 5505 7118 V InputMethodManagerService: Client requesting input be hidden, flags : 0
    06-26 17:40:36.283 5505 7118 V InputMethodManagerService: hideCurrentInputLocked : shouldHideSoftInput is false
    06-26 17:40:36.314 13661 20884 I BCL@Common: (ProvisionProvider) query, content://com.samsung.android.bixby.agent.common.provision/service_id
    06-26 17:40:36.317 7200 13733 D BWU@VoiceWakeupInfo: getBixbyServiceID :
    06-26 17:40:36.317 7200 13733 I SamsungAnalyticsUtil: :Ph::SamsungAnalytics can't setConfiguration because serviceId is empty after 68019000
    06-26 17:40:36.467 7615 7615 I SKBD : and isTosAccept false
    06-26 17:40:36.668 7615 7615 I chatty : uid=10168(com.sec.android.inputmethod) identical 1 line
    06-26 17:40:36.869 7615 7615 I SKBD : and isTosAccept false

  7. KojiNakamaru commented on Jun 28, 2021

    @KojiNakamaru
    Member

    I'm sorry for the inconvenience. Since #655 , a dialog for requesting permissions will be shown only if one of the following permissions are enabled:

    int hasPerm1 = pm.checkPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE, activity.getPackageName());
    int hasPerm2 = pm.checkPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE, activity.getPackageName());
    int hasPerm3 = pm.checkPermission(android.Manifest.permission.CAMERA, activity.getPackageName());

    You can enable the camera access by defining UNITYWEBVIEW_ANDROID_ENABLE_CAMERA or can enable the external storage access by setting Player Settings/Other Settings/Write Permission to External (SDCard). Once the dialog is shown and a user agrees, <input type="file"> should work.

    I'll later update README.md about this point.

  8. wantsliveforever commented on Jun 28, 2021

    @wantsliveforever

    Hello! Thank you for answer!
    Yes, I have already declared a variable UNITYWEBVIEW_ANDROID_ENABLE_CAMERA and Microphone. And set Permittion.Camera in to SampleWebView.cs
    Today i'll try to Android resolver -> Force resolve

  9. KojiNakamaru commented on Jun 29, 2021

    @KojiNakamaru
    Member

    UNITYWEBVIEW_ANDROID_ENABLE_CAMERA should not be declared as a variable, should be defined as below:

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions