Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9148

Add support for file picker in InAppBrowser

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0, 3.6.0
    • Fix Version/s: None
    • Component/s: Plugin InAppBrowser
    • Environment:

      problem in Android, the camera roll never opens (iOS working OK)

    • Flags:
      Patch

      Description

      reproduce :
      open the inAppBrowser: http://www.plupload.com/examples
      click in Add files.

      This works ok when I call it from the _system or _self. But not for _blank.

        Issue Links

          Activity

          Hide
          bowserj Joe Bowser added a comment -

          The Cordova InAppBrowser on Android does not support this functionality currently.

          Show
          bowserj Joe Bowser added a comment - The Cordova InAppBrowser on Android does not support this functionality currently.
          Hide
          dreamvi Ram added a comment - - edited

          Hi,
          In my project, I am using cordova-plugin-inappbrowser (1.4) from npm packages.

          I get different results for different OS/platform's.

          I use java code to access inbuilt camera/photo libraries/upload function from my own site. Use the URLwithing the application.

          Type Platform Result
          1) _blank iOS 8.3 Can't access camera, but can get to libraries of pictures from the device
          2) _blank iOS 9.3 All works fine: Can access camera, library of pictures from the device
          3) _self iOS 8.3, 9.3, android Nothing works (Network access & Intent: tried *) not sure whether to try https://* or http://* etc.??

          4) _blank android tried lots of 4.X Nothing works
          If iOS 8.3 can't access camera within inappBrowser of 1.4, might be an issue at iOS end, but none of the Android (tested 4.4, 4.3, etc..) is NOT working.

          Can we get inAppBrowser access to camera, library function & file upload functions similar to iOS please?

          Thanks in advance

          Show
          dreamvi Ram added a comment - - edited Hi, In my project, I am using cordova-plugin-inappbrowser (1.4) from npm packages. I get different results for different OS/platform's. I use java code to access inbuilt camera/photo libraries/upload function from my own site. Use the URLwithing the application. Type Platform Result 1) _blank iOS 8.3 Can't access camera, but can get to libraries of pictures from the device 2) _blank iOS 9.3 All works fine: Can access camera, library of pictures from the device 3) _self iOS 8.3, 9.3, android Nothing works (Network access & Intent: tried *) not sure whether to try https://* or http://* etc.?? 4) _blank android tried lots of 4.X Nothing works If iOS 8.3 can't access camera within inappBrowser of 1.4, might be an issue at iOS end, but none of the Android (tested 4.4, 4.3, etc..) is NOT working. Can we get inAppBrowser access to camera, library function & file upload functions similar to iOS please? Thanks in advance
          Hide
          jcesarmobile jcesarmobile added a comment -

          Ram this issue is for Android.

          On iOS the file picker/camera is handled by the webview and there is nothing we can do to change the behaviour, but in my tests the camera works on iOS 8 too.

          Show
          jcesarmobile jcesarmobile added a comment - Ram this issue is for Android. On iOS the file picker/camera is handled by the webview and there is nothing we can do to change the behaviour, but in my tests the camera works on iOS 8 too.
          Hide
          jay8585 Darron Park added a comment - - edited

          The Code below fixed this problem for me.
          Maybe someone can contribute this code to inappbrowser source.

          > Source: InAppBrowser.java

          > First, I imported some Classes
          ----------------------------------------------------
          import android.util.Log;
          import android.webkit.ValueCallback;
          import android.webkit.WebChromeClient;
          ----------------------------------------------------
          > Second, I added some variables in InAppBrowser class.
          ----------------------------------------------------
          private ValueCallback<Uri> mUploadMessage;
          private ValueCallback<Uri[]> mUploadMessageLollipop;
          private final static int FILECHOOSER_RESULTCODE = 1;
          private final static int FILECHOOSER_LOLLIPOP_RESULTCODE = 2;
          ----------------------------------------------------

          > Then, I changed the code from...
          ----------------------------------------------------
          inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
          ----------------------------------------------------
          > to...
          ----------------------------------------------------
          inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {

          public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)

          { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); Log.i("mytag", "openFileChooser Executed"); cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); }

          public void showFileChooser(ValueCallback<String[]> filePathCallback, String acceptType, boolean paramBoolean)

          { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); Log.i("mytag", "showFileChooser Executed"); cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); }

          // For Android 5.0+
          public boolean onShowFileChooser(
          WebView webView, ValueCallback<Uri[]> filePathCallback,
          WebChromeClient.FileChooserParams fileChooserParams)

          { mUploadMessageLollipop = filePathCallback; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); Log.d("MainActivity", "5.0+"); cordova.getActivity().startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_LOLLIPOP_RESULTCODE); return true; }

          });
          ----------------------------------------------------

          > Also added method below to InAppBrowser class
          ----------------------------------------------------
          public void onActivityResult(int requestCode, int resultCode, Intent intent) {
          Log.i("mytag", "onActivityResult");
          if (requestCode == FILECHOOSER_RESULTCODE)

          { Log.i("mytag", "onActivityResult (File Chooser)"); if (null == mUploadMessage) return; Uri result = intent == null || resultCode != cordova.getActivity().RESULT_OK ? null : intent.getData(); mUploadMessage.onReceiveValue(result); mUploadMessage = null; }

          else if(requestCode == FILECHOOSER_LOLLIPOP_RESULTCODE) {
          Log.i("mytag", "onActivityResult (File Chooser Lollipop)");
          if (mUploadMessageLollipop == null) return ;
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)

          { mUploadMessageLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent)); }

          mUploadMessageLollipop = null;
          }
          }
          ----------------------------------------------------

          I can't understand why this basic function is not yet implemented to InAppBrowser

          Show
          jay8585 Darron Park added a comment - - edited The Code below fixed this problem for me. Maybe someone can contribute this code to inappbrowser source. > Source: InAppBrowser.java > First, I imported some Classes ---------------------------------------------------- import android.util.Log; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; ---------------------------------------------------- > Second, I added some variables in InAppBrowser class. ---------------------------------------------------- private ValueCallback<Uri> mUploadMessage; private ValueCallback<Uri[]> mUploadMessageLollipop; private final static int FILECHOOSER_RESULTCODE = 1; private final static int FILECHOOSER_LOLLIPOP_RESULTCODE = 2; ---------------------------------------------------- > Then, I changed the code from... ---------------------------------------------------- inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); ---------------------------------------------------- > to... ---------------------------------------------------- inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); Log.i("mytag", "openFileChooser Executed"); cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } public void showFileChooser(ValueCallback<String[]> filePathCallback, String acceptType, boolean paramBoolean) { Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); Log.i("mytag", "showFileChooser Executed"); cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } // For Android 5.0+ public boolean onShowFileChooser( WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) { mUploadMessageLollipop = filePathCallback; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); Log.d("MainActivity", "5.0+"); cordova.getActivity().startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_LOLLIPOP_RESULTCODE); return true; } }); ---------------------------------------------------- > Also added method below to InAppBrowser class ---------------------------------------------------- public void onActivityResult(int requestCode, int resultCode, Intent intent) { Log.i("mytag", "onActivityResult"); if (requestCode == FILECHOOSER_RESULTCODE) { Log.i("mytag", "onActivityResult (File Chooser)"); if (null == mUploadMessage) return; Uri result = intent == null || resultCode != cordova.getActivity().RESULT_OK ? null : intent.getData(); mUploadMessage.onReceiveValue(result); mUploadMessage = null; } else if(requestCode == FILECHOOSER_LOLLIPOP_RESULTCODE) { Log.i("mytag", "onActivityResult (File Chooser Lollipop)"); if (mUploadMessageLollipop == null) return ; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mUploadMessageLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent)); } mUploadMessageLollipop = null; } } ---------------------------------------------------- I can't understand why this basic function is not yet implemented to InAppBrowser
          Hide
          andersborg Anders Borg added a comment -

          This has become a major issue for a combined app and CMS solution my company provides.

          The CMS supports configuring arbitrary forms and surveys, where uploading files like pictures for status reports, job applications etc is supported by the CMS, but can't be used from the app when such sites are invoked via inappbrowser.

          We can't go statically to a specific site (without inappbrowser) as the user decides on the fly what sites to visit. The app provides a smorgasboard of available sites. We also need a simple way of returning to the app's main view, however deeply the user navigated on any particular site. Therefore inappbrowser plays an important role.

          I guess we could use some other webview component, if there's any that supports this, and doesn't break something else, but that adds a lot to the app size.

          So, this is another request to have this implemented.

          Show
          andersborg Anders Borg added a comment - This has become a major issue for a combined app and CMS solution my company provides. The CMS supports configuring arbitrary forms and surveys, where uploading files like pictures for status reports, job applications etc is supported by the CMS, but can't be used from the app when such sites are invoked via inappbrowser. We can't go statically to a specific site (without inappbrowser) as the user decides on the fly what sites to visit. The app provides a smorgasboard of available sites. We also need a simple way of returning to the app's main view, however deeply the user navigated on any particular site. Therefore inappbrowser plays an important role. I guess we could use some other webview component, if there's any that supports this, and doesn't break something else, but that adds a lot to the app size. So, this is another request to have this implemented.
          Hide
          mopages Mo Pages added a comment -

          Nice, but didn't work for me (on a Nexus 5x running Android 6.1). The upload dialog appears but after selecting a file the file doesn't upload... the log says:
          MainActivity: 5.0+
          CordovaInterfaceImpl: Got an activity result, but no plugin was registered to receive it.

          Show
          mopages Mo Pages added a comment - Nice, but didn't work for me (on a Nexus 5x running Android 6.1). The upload dialog appears but after selecting a file the file doesn't upload... the log says: MainActivity: 5.0+ CordovaInterfaceImpl: Got an activity result, but no plugin was registered to receive it.
          Hide
          jay8585 Darron Park added a comment -

          Hmm...

          Actually I found some bug that this module works only one time.
          So I'm going to update it today

          Show
          jay8585 Darron Park added a comment - Hmm... Actually I found some bug that this module works only one time. So I'm going to update it today
          Hide
          calderson Chris Alderson added a comment -

          Hey Darron,
          I used your code above and it does work in having the Android file picker open up whereas it did not before I added your code. However, as you already mentioned it only works the first time, and as Mo Pages discovered, it doesn't actually submit the file to the server.

          Any chance you've had some time to look into this further? It would make my life so much easier if I could get this to work!

          Show
          calderson Chris Alderson added a comment - Hey Darron, I used your code above and it does work in having the Android file picker open up whereas it did not before I added your code. However, as you already mentioned it only works the first time, and as Mo Pages discovered, it doesn't actually submit the file to the server. Any chance you've had some time to look into this further? It would make my life so much easier if I could get this to work!
          Hide
          jay8585 Darron Park added a comment -

          Sorry.. I was busy these days... But I'm planning to restart fixing this issue on January 2017.
          So don't give up with fixing this issue

          Show
          jay8585 Darron Park added a comment - Sorry.. I was busy these days... But I'm planning to restart fixing this issue on January 2017. So don't give up with fixing this issue
          Hide
          jay8585 Darron Park added a comment -

          Now I Finally Created Working Code.
          This code below is tested only in Android Marshmellow(6.0).
          So if anyone has Lollipop or Kitkat device, it would be nice to help me with testing it

          First, I imported some Classes

          InAppBrowser.java
          import android.util.Log;
          import android.webkit.ValueCallback;
          import android.webkit.WebChromeClient;
          

          Second, I added some variables to InAppBrowser class.

          InAppBrowser.java
          private ValueCallback<Uri> mUploadCallback;
          private ValueCallback<Uri[]> mUploadCallbackLollipop;
          private final static int FILECHOOSER_REQUESTCODE = 1;
          private final static int FILECHOOSER_REQUESTCODE_LOLLIPOP = 2;
          

          Then, I changed the code from...

          InAppBrowser.java(before)
          inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
          

          to...

          InAppBrowser.java(after)
          // File Chooser Implemented ChromeClient
          inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
              // For Android 5.0+
              public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
              {
                  Log.d(LOG_TAG, "File Chooser 5.0+");
                  // If callback exists, finish it.
                  if(mUploadCallbackLollipop != null) {
                      mUploadCallbackLollipop.onReceiveValue(null);
                  }
                  mUploadCallbackLollipop = filePathCallback;
          
                  // Create File Chooser Intent
                  Intent content = new Intent(Intent.ACTION_GET_CONTENT);
                  content.addCategory(Intent.CATEGORY_OPENABLE);
                  content.setType("*/*");
          
                  // [important] Register ActvityResultCallback on Cordova
                  cordova.setActivityResultCallback(InAppBrowser.this);
                  cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP);
                  return true;
              }
          
              // For Android 4.1+
              public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
              {
                  Log.d(LOG_TAG, "File Chooser 4.1+");
                  // Call file chooser for Android 3.0+
                  openFileChooser(uploadMsg, acceptType);
              }
          
              // For Android 3.0+
              public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType)
              {
                  Log.d(LOG_TAG, "File Chooser 3.0+");
                  mUploadCallback = uploadMsg;
                  Intent i = new Intent(Intent.ACTION_GET_CONTENT);
                  i.addCategory(Intent.CATEGORY_OPENABLE);
          
                  cordova.setActivityResultCallback(InAppBrowser.this);
                  cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE);
              }
          
              // For Android < 3.0
              public void openFileChooser(ValueCallback<Uri> uploadMsg) {
                  Log.d(LOG_TAG, "File Chooser 3.0 <");
                  // Call file chooser for Android 3.0+
                  openFileChooser(uploadMsg, "");
              }
          
          });
          

          I Also added method below(onActivityResult) to InAppBrowser class

          InAppBrowser.java(after)
          public void onActivityResult(int requestCode, int resultCode, Intent intent) {
              // For Android >= 5.0
              if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                  Log.i("mytag", "onActivityResult (For Android >= 5.0)");
                  // If RequestCode or Callback is Invalid
                  if(requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null) {
                      super.onActivityResult(requestCode, resultCode, intent);
                      return;
                  }
                  mUploadCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
                  mUploadCallbackLollipop = null;
              }
              // For Android < 5.0
              else {
                  Log.i("mytag", "onActivityResult (For Android < 5.0)");
                  // If RequestCode or Callback is Invalid
                  if(requestCode != FILECHOOSER_REQUESTCODE || mUploadCallback == null) {
                      super.onActivityResult(requestCode, resultCode, intent);
                      return;
                  }
          
                  if (null == mUploadCallback) return;
                  Uri result = intent == null || resultCode != cordova.getActivity().RESULT_OK ? null : intent.getData();
          
                  mUploadCallback.onReceiveValue(result);
                  mUploadCallback = null;
              }
          }
          

          Now you are done.
          In my case, it worked well with no error.
          Give it a try and any comment will be appreciated
          Happy New Year

          Show
          jay8585 Darron Park added a comment - Now I Finally Created Working Code. This code below is tested only in Android Marshmellow(6.0). So if anyone has Lollipop or Kitkat device, it would be nice to help me with testing it First, I imported some Classes InAppBrowser.java import android.util.Log; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; Second, I added some variables to InAppBrowser class. InAppBrowser.java private ValueCallback<Uri> mUploadCallback; private ValueCallback<Uri[]> mUploadCallbackLollipop; private final static int FILECHOOSER_REQUESTCODE = 1; private final static int FILECHOOSER_REQUESTCODE_LOLLIPOP = 2; Then, I changed the code from... InAppBrowser.java(before) inAppWebView.setWebChromeClient( new InAppChromeClient(thatWebView)); to... InAppBrowser.java(after) // File Chooser Implemented ChromeClient inAppWebView.setWebChromeClient( new InAppChromeClient(thatWebView) { // For Android 5.0+ public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) { Log.d(LOG_TAG, "File Chooser 5.0+" ); // If callback exists, finish it. if (mUploadCallbackLollipop != null ) { mUploadCallbackLollipop.onReceiveValue( null ); } mUploadCallbackLollipop = filePathCallback; // Create File Chooser Intent Intent content = new Intent(Intent.ACTION_GET_CONTENT); content.addCategory(Intent.CATEGORY_OPENABLE); content.setType( "*/*" ); // [important] Register ActvityResultCallback on Cordova cordova.setActivityResultCallback(InAppBrowser. this ); cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); return true ; } // For Android 4.1+ public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { Log.d(LOG_TAG, "File Chooser 4.1+" ); // Call file chooser for Android 3.0+ openFileChooser(uploadMsg, acceptType); } // For Android 3.0+ public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) { Log.d(LOG_TAG, "File Chooser 3.0+" ); mUploadCallback = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); cordova.setActivityResultCallback(InAppBrowser. this ); cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser" ), FILECHOOSER_REQUESTCODE); } // For Android < 3.0 public void openFileChooser(ValueCallback<Uri> uploadMsg) { Log.d(LOG_TAG, "File Chooser 3.0 <" ); // Call file chooser for Android 3.0+ openFileChooser(uploadMsg, ""); } }); I Also added method below(onActivityResult) to InAppBrowser class InAppBrowser.java(after) public void onActivityResult( int requestCode, int resultCode, Intent intent) { // For Android >= 5.0 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Log.i( "mytag" , "onActivityResult (For Android >= 5.0)" ); // If RequestCode or Callback is Invalid if (requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null ) { super .onActivityResult(requestCode, resultCode, intent); return ; } mUploadCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent)); mUploadCallbackLollipop = null ; } // For Android < 5.0 else { Log.i( "mytag" , "onActivityResult (For Android < 5.0)" ); // If RequestCode or Callback is Invalid if (requestCode != FILECHOOSER_REQUESTCODE || mUploadCallback == null ) { super .onActivityResult(requestCode, resultCode, intent); return ; } if ( null == mUploadCallback) return ; Uri result = intent == null || resultCode != cordova.getActivity().RESULT_OK ? null : intent.getData(); mUploadCallback.onReceiveValue(result); mUploadCallback = null ; } } Now you are done. In my case, it worked well with no error. Give it a try and any comment will be appreciated Happy New Year
          Hide
          bowserj Joe Bowser added a comment -

          This wasn't implemented because nobody got around to implementing it or felt like actually implementing it until now. The fastest way for this to be added is to do the following:

          1. Sign an ICLA. Since this is a non-trivial amount of code, we require an ICLA to be signed. Please sign an ICLA, more information can be found at http://www.apache.org/licenses/#clas
          2. Send a GitHub Pull Request: Cordova uses git, and we do accept pull requests. Here's our Public-Facing GitHub repository:
          https://github.com/apache/cordova-plugin-inappbrowser

          If you need more information on how to do this, please read these contribution guidelines:
          https://cordova.apache.org/contribute/contribute_guidelines.html

          Show
          bowserj Joe Bowser added a comment - This wasn't implemented because nobody got around to implementing it or felt like actually implementing it until now. The fastest way for this to be added is to do the following: 1. Sign an ICLA. Since this is a non-trivial amount of code, we require an ICLA to be signed. Please sign an ICLA, more information can be found at http://www.apache.org/licenses/#clas 2. Send a GitHub Pull Request: Cordova uses git, and we do accept pull requests. Here's our Public-Facing GitHub repository: https://github.com/apache/cordova-plugin-inappbrowser If you need more information on how to do this, please read these contribution guidelines: https://cordova.apache.org/contribute/contribute_guidelines.html
          Hide
          jay8585 Darron Park added a comment -

          Okay..
          It was first time for me to pull request...
          But I did it anyway, I hope this change to be accepted
          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          Show
          jay8585 Darron Park added a comment - Okay.. It was first time for me to pull request... But I did it anyway, I hope this change to be accepted https://github.com/apache/cordova-plugin-inappbrowser/pull/205
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user cordova-qa commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          Cordova CI Build has completed successfully.

          *Commit* - [Link](https://github.com/apache/cordova-plugin-inappbrowser/pull/205/commits/cf3adcb9413ca23f1fbdae9f40b4205e40a710ae)
          *Dashboard* - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109/)

          Builder Name Console Output Test Report Device Logs
          :---: :---: :---: :---:
          [Windows 10 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/artifact/)
          [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/artifact/)
          [Android 4.4]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/artifact/)
          [Android 5.1]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/artifact/)
          Show
          githubbot ASF GitHub Bot added a comment - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 Cordova CI Build has completed successfully. * Commit * - [Link] ( https://github.com/apache/cordova-plugin-inappbrowser/pull/205/commits/cf3adcb9413ca23f1fbdae9f40b4205e40a710ae ) * Dashboard * - [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109/ ) Builder Name Console Output Test Report Device Logs :---: :---: :---: :---: [Windows 10 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=windows-10-store/artifact/ ) [iOS] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=ios/artifact/ ) [Android 4.4] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-4.4/artifact/ ) [Android 5.1] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/109//PLATFORM=android-5.1/artifact/ )
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94451894

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            +
            Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + }

            +
            + // For Android 4.1+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
            +

            { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + }

            +
            + // For Android 3.0+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType)
            + {
            + Log.d(LOG_TAG, "File Chooser 3.0+");
            + mUploadCallback = uploadMsg;
            + Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            + i.addCategory(Intent.CATEGORY_OPENABLE);
            +
            + cordova.setActivityResultCallback(InAppBrowser.this);
            + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE);

              • End diff –

          This should also be using the plugin API to start the activity for result.

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94451894 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + } + + // For Android 4.1+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) + { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + } + + // For Android 3.0+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) + { + Log.d(LOG_TAG, "File Chooser 3.0+"); + mUploadCallback = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE); End diff – This should also be using the plugin API to start the activity for result.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94452072

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            +
            Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + }

            +
            + // For Android 4.1+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
            +

            { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + }

            +
            + // For Android 3.0+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType)
            +

            { + Log.d(LOG_TAG, "File Chooser 3.0+"); + mUploadCallback = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE); + }

            +
            + // For Android < 3.0
            + public void openFileChooser(ValueCallback<Uri> uploadMsg)

            { + Log.d(LOG_TAG, "File Chooser 3.0 <"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, ""); + }

            +

              • End diff –

          Why does this need to be here? We do not support any versions of Android below Android 4.1, so this would never be called.

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94452072 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + } + + // For Android 4.1+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) + { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + } + + // For Android 3.0+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) + { + Log.d(LOG_TAG, "File Chooser 3.0+"); + mUploadCallback = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE); + } + + // For Android < 3.0 + public void openFileChooser(ValueCallback<Uri> uploadMsg) { + Log.d(LOG_TAG, "File Chooser 3.0 <"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, ""); + } + End diff – Why does this need to be here? We do not support any versions of Android below Android 4.1, so this would never be called.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94451785

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            + {
            + Log.d(LOG_TAG, "File Chooser 5.0+");
            + // If callback exists, finish it.
            + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + }

            + mUploadCallbackLollipop = filePathCallback;
            +
            + // Create File Chooser Intent
            + Intent content = new Intent(Intent.ACTION_GET_CONTENT);
            + content.addCategory(Intent.CATEGORY_OPENABLE);
            + content.setType("/");
            +
            + // [important] Register ActvityResultCallback on Cordova
            + cordova.setActivityResultCallback(InAppBrowser.this);
            + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP);

              • End diff –

          This should be using the Plugin API's startActivityForResult where you pass in the plugin that you're sending the Activity to. Doing this is actually very unstable, and can be unpredictable since other plugins also use Intents.

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94451785 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType(" / "); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); End diff – This should be using the Plugin API's startActivityForResult where you pass in the plugin that you're sending the Activity to. Doing this is actually very unstable, and can be unpredictable since other plugins also use Intents.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94452235

          — Diff: src/android/InAppBrowser.java —
          @@ -832,6 +889,42 @@ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Statu
          }

          /**
          + * Receive File Data from File Chooser
          + *
          + * @param requestCode the requested code from chromeclient
          + * @param resultCode the result code returned from android system
          + * @param intent the data from android file chooser
          + */
          + public void onActivityResult(int requestCode, int resultCode, Intent intent) {
          + // For Android >= 5.0
          + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
          + Log.i("mytag", "onActivityResult (For Android >= 5.0)");
          + // If RequestCode or Callback is Invalid
          + if(requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null)

          { + super.onActivityResult(requestCode, resultCode, intent); + return; + }

          + mUploadCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
          — End diff –

          Is there a reason that the indenting is broken here?

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94452235 — Diff: src/android/InAppBrowser.java — @@ -832,6 +889,42 @@ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Statu } /** + * Receive File Data from File Chooser + * + * @param requestCode the requested code from chromeclient + * @param resultCode the result code returned from android system + * @param intent the data from android file chooser + */ + public void onActivityResult(int requestCode, int resultCode, Intent intent) { + // For Android >= 5.0 + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Log.i("mytag", "onActivityResult (For Android >= 5.0)"); + // If RequestCode or Callback is Invalid + if(requestCode != FILECHOOSER_REQUESTCODE_LOLLIPOP || mUploadCallbackLollipop == null) { + super.onActivityResult(requestCode, resultCode, intent); + return; + } + mUploadCallbackLollipop.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent)); — End diff – Is there a reason that the indenting is broken here?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jcesarmobile commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94467650

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            +
            Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + }

            +
            + // For Android 4.1+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
            +

            { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + }

            +
            + // For Android 3.0+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType)
            +

            { + Log.d(LOG_TAG, "File Chooser 3.0+"); + mUploadCallback = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE); + }

            +
            + // For Android < 3.0
            + public void openFileChooser(ValueCallback<Uri> uploadMsg)

            { + Log.d(LOG_TAG, "File Chooser 3.0 <"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, ""); + }

            +

              • End diff –

          Well, latest cordova-android doesn't support Android versions below 4.1, but the plugin can be used with older versions of cordova-android as we have the engine set to cordova >=3.1.0. We should bump the engine version to the one that started setting the SDK version to 16 if we are not going to support older Android versions in plugins.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94467650 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + } + + // For Android 4.1+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) + { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + } + + // For Android 3.0+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) + { + Log.d(LOG_TAG, "File Chooser 3.0+"); + mUploadCallback = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE); + } + + // For Android < 3.0 + public void openFileChooser(ValueCallback<Uri> uploadMsg) { + Log.d(LOG_TAG, "File Chooser 3.0 <"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, ""); + } + End diff – Well, latest cordova-android doesn't support Android versions below 4.1, but the plugin can be used with older versions of cordova-android as we have the engine set to cordova >=3.1.0. We should bump the engine version to the one that started setting the SDK version to 16 if we are not going to support older Android versions in plugins.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94468334

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            +
            Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + }

            +
            + // For Android 4.1+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture)
            +

            { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + }

            +
            + // For Android 3.0+
            + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType)
            +

            { + Log.d(LOG_TAG, "File Chooser 3.0+"); + mUploadCallback = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE); + }

            +
            + // For Android < 3.0
            + public void openFileChooser(ValueCallback<Uri> uploadMsg)

            { + Log.d(LOG_TAG, "File Chooser 3.0 <"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, ""); + }

            +

              • End diff –

          @jcesarmobile In this case, this method is supporting versions of Android below 3.0, and we don't have a version of Cordova that we support or maintain that uses this.

          For some reason the version that supports 3.0 and higher is the primary method, so we have to keep it, but I have no idea why this method is needed.

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94468334 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + Unknown macro: { + Log.d(LOG_TAG, "File Chooser 5.0+"); + // If callback exists, finish it. + if(mUploadCallbackLollipop != null) { + mUploadCallbackLollipop.onReceiveValue(null); + } + mUploadCallbackLollipop = filePathCallback; + + // Create File Chooser Intent + Intent content = new Intent(Intent.ACTION_GET_CONTENT); + content.addCategory(Intent.CATEGORY_OPENABLE); + content.setType("*/*"); + + // [important] Register ActvityResultCallback on Cordova + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP); + return true; + } + + // For Android 4.1+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) + { + Log.d(LOG_TAG, "File Chooser 4.1+"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, acceptType); + } + + // For Android 3.0+ + public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) + { + Log.d(LOG_TAG, "File Chooser 3.0+"); + mUploadCallback = uploadMsg; + Intent i = new Intent(Intent.ACTION_GET_CONTENT); + i.addCategory(Intent.CATEGORY_OPENABLE); + + cordova.setActivityResultCallback(InAppBrowser.this); + cordova.getActivity().startActivityForResult( Intent.createChooser(i, "File Chooser"), FILECHOOSER_REQUESTCODE); + } + + // For Android < 3.0 + public void openFileChooser(ValueCallback<Uri> uploadMsg) { + Log.d(LOG_TAG, "File Chooser 3.0 <"); + // Call file chooser for Android 3.0+ + openFileChooser(uploadMsg, ""); + } + End diff – @jcesarmobile In this case, this method is supporting versions of Android below 3.0, and we don't have a version of Cordova that we support or maintain that uses this. For some reason the version that supports 3.0 and higher is the primary method, so we have to keep it, but I have no idea why this method is needed.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jcesarmobile commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94507888

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            + {
            + Log.d(LOG_TAG, "File Chooser 5.0+");
              • End diff –

          We use LOG instead of Log to use Cordova LOG instead of default Log, so it can be disabled with a preference.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jcesarmobile commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94507888 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + { + Log.d(LOG_TAG, "File Chooser 5.0+"); End diff – We use LOG instead of Log to use Cordova LOG instead of default Log, so it can be disabled with a preference.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94508708

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            + {
            + Log.d(LOG_TAG, "File Chooser 5.0+");
              • End diff –

          I'm going to open an issue to create an Android Style Guide or something. I kinda feel bad we're being this nit-picky on someone's first PR. (I'm still going to do it, because we're supposed to, but still)

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94508708 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + { + Log.d(LOG_TAG, "File Chooser 5.0+"); End diff – I'm going to open an issue to create an Android Style Guide or something. I kinda feel bad we're being this nit-picky on someone's first PR. (I'm still going to do it, because we're supposed to, but still)
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user darron1217 commented on a diff in the pull request:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94530284

          — Diff: src/android/InAppBrowser.java —
          @@ -722,7 +729,57 @@ public void onClick(View v) {
          inAppWebView = new WebView(cordova.getActivity());
          inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
          inAppWebView.setId(Integer.valueOf(6));

          • inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
            + // File Chooser Implemented ChromeClient
            + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
            + // For Android 5.0+
            + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
            + {
            + Log.d(LOG_TAG, "File Chooser 5.0+");
              • End diff –

          @infil00p It's okay because I'm really enjoying this process
          I am the person who loves stable and beautiful codes.
          Thanks for all the comments and interests about my suggestion!
          I'm newbie here, but I'll try hard to be a good contributor here

          Show
          githubbot ASF GitHub Bot added a comment - Github user darron1217 commented on a diff in the pull request: https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94530284 — Diff: src/android/InAppBrowser.java — @@ -722,7 +729,57 @@ public void onClick(View v) { inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); inAppWebView.setId(Integer.valueOf(6)); inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView)); + // File Chooser Implemented ChromeClient + inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) { + // For Android 5.0+ + public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) + { + Log.d(LOG_TAG, "File Chooser 5.0+"); End diff – @infil00p It's okay because I'm really enjoying this process I am the person who loves stable and beautiful codes. Thanks for all the comments and interests about my suggestion! I'm newbie here, but I'll try hard to be a good contributor here
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user darron1217 commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          I fixed my code according to comments

          Show
          githubbot ASF GitHub Bot added a comment - Github user darron1217 commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 I fixed my code according to comments
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user cordova-qa commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          Cordova CI Build has completed successfully.

          *Commit* - [Link](https://github.com/apache/cordova-plugin-inappbrowser/pull/205/commits/48190731fd6d288ea81e9e3f479390c76e26226d)
          *Dashboard* - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110/)

          Builder Name Console Output Test Report Device Logs
          :---: :---: :---: :---:
          [Windows 10 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/artifact/)
          [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/artifact/)
          [Android 4.4]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/artifact/)
          [Android 5.1]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/artifact/)
          Show
          githubbot ASF GitHub Bot added a comment - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 Cordova CI Build has completed successfully. * Commit * - [Link] ( https://github.com/apache/cordova-plugin-inappbrowser/pull/205/commits/48190731fd6d288ea81e9e3f479390c76e26226d ) * Dashboard * - [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110/ ) Builder Name Console Output Test Report Device Logs :---: :---: :---: :---: [Windows 10 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=windows-10-store/artifact/ ) [iOS] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=ios/artifact/ ) [Android 4.4] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-4.4/artifact/ ) [Android 5.1] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-inappbrowser-pr/110//PLATFORM=android-5.1/artifact/ )
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @darron1217 Looks good! Did you get the iCLA in? Once you do that, I'll merge this.

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @darron1217 Looks good! Did you get the iCLA in? Once you do that, I'll merge this.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-inappbrowser/pull/205
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          Congrats on your first major contribution to Cordova! Well done!

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 Congrats on your first major contribution to Cordova! Well done!
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user darron1217 commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @infil00p Thank you for your guidance
          I was glad that my work can be help for improving project :+1:

          Show
          githubbot ASF GitHub Bot added a comment - Github user darron1217 commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @infil00p Thank you for your guidance I was glad that my work can be help for improving project :+1:
          Hide
          jcesarmobile jcesarmobile added a comment -

          Fixed in 1.6.2-dev

          Show
          jcesarmobile jcesarmobile added a comment - Fixed in 1.6.2-dev
          Hide
          calderson Chris Alderson added a comment -

          Sweet! Can't wait to try it out! Thanks for doing this Darron Park

          Show
          calderson Chris Alderson added a comment - Sweet! Can't wait to try it out! Thanks for doing this Darron Park
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user markusjwetzel commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          Does not seem to work for me on Android 4.3. When I try to choose a file for an input[type=file] field, I get an "application for this action cannot be found" error.

          Show
          githubbot ASF GitHub Bot added a comment - Github user markusjwetzel commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 Does not seem to work for me on Android 4.3. When I try to choose a file for an input [type=file] field, I get an "application for this action cannot be found" error.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user darron1217 commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @markusjwetzel I've just tested it on Android 4.4 and as you said, it isn't working...
          I'll fix it ASAP

          Show
          githubbot ASF GitHub Bot added a comment - Github user darron1217 commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @markusjwetzel I've just tested it on Android 4.4 and as you said, it isn't working... I'll fix it ASAP
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user darron1217 commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @markusjwetzel Did you tested it on real device?

          Show
          githubbot ASF GitHub Bot added a comment - Github user darron1217 commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @markusjwetzel Did you tested it on real device?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user infil00p commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @markusjwetzel @darron1217 Technically, this won't work on any version of Android below API Level 21:
          https://developer.android.com/reference/android/webkit/WebChromeClient.html

          And, Google didn't remove the functionality, in fact they added it with the 5.0.x release.

          Show
          githubbot ASF GitHub Bot added a comment - Github user infil00p commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @markusjwetzel @darron1217 Technically, this won't work on any version of Android below API Level 21: https://developer.android.com/reference/android/webkit/WebChromeClient.html And, Google didn't remove the functionality, in fact they added it with the 5.0.x release.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jcesarmobile commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @infil00p `openFileChooser` wasn't a public API, but it was working before Android 4.4.0. In android 4.4.0 they decided to remove it and said that it wasn't a public API https://code.google.com/p/android/issues/detail?id=62220
          Then they added it back in 4.4.3, so on 4.4.0, 4.4.1 and 4.4.2 it won't work.
          And finally in Android 5 they added the public API `onShowFileChooser`

          I agree, this should be a new issue.

          @darron1217, BTW, you can take a look into the implementation in the Cordova webview, I think it works fine with Android 4.3
          https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java

          Show
          githubbot ASF GitHub Bot added a comment - Github user jcesarmobile commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @infil00p `openFileChooser` wasn't a public API, but it was working before Android 4.4.0. In android 4.4.0 they decided to remove it and said that it wasn't a public API https://code.google.com/p/android/issues/detail?id=62220 Then they added it back in 4.4.3, so on 4.4.0, 4.4.1 and 4.4.2 it won't work. And finally in Android 5 they added the public API `onShowFileChooser` I agree, this should be a new issue. @darron1217, BTW, you can take a look into the implementation in the Cordova webview, I think it works fine with Android 4.3 https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user markusjwetzel commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @darron1217 Yes, I tested it on a real device.

          Show
          githubbot ASF GitHub Bot added a comment - Github user markusjwetzel commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @darron1217 Yes, I tested it on a real device.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user darron1217 commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @infil00p @jcesarmobile Thanks for all the contents
          Now I can clearly see what's going on with this strange input=file bug....

          @markusjwetzel Can you help me with sharing a detailed debug log from Logcat?

          Show
          githubbot ASF GitHub Bot added a comment - Github user darron1217 commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @infil00p @jcesarmobile Thanks for all the contents Now I can clearly see what's going on with this strange input=file bug.... @markusjwetzel Can you help me with sharing a detailed debug log from Logcat?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user darron1217 commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          @markusjwetzel Can you share your detailed error log?
          I think the error "application for this action cannot be found" is not a general issue.

          Show
          githubbot ASF GitHub Bot added a comment - Github user darron1217 commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 @markusjwetzel Can you share your detailed error log? I think the error "application for this action cannot be found" is not a general issue.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user markusjwetzel commented on the issue:

          https://github.com/apache/cordova-plugin-inappbrowser/pull/205

          Sorry, really new to app development, so I don't know how to get an error log from a real device and don't really have time to figure that out. But I guess that this error can be reproduced easily.

          The error was translated from German. So the official English version might differ a bit, but at least the meaning should be the same. Hope that helps a little bit. ๐Ÿ˜ƒ

          Show
          githubbot ASF GitHub Bot added a comment - Github user markusjwetzel commented on the issue: https://github.com/apache/cordova-plugin-inappbrowser/pull/205 Sorry, really new to app development, so I don't know how to get an error log from a real device and don't really have time to figure that out. But I guess that this error can be reproduced easily. The error was translated from German. So the official English version might differ a bit, but at least the meaning should be the same. Hope that helps a little bit. ๐Ÿ˜ƒ

            People

            • Assignee:
              Unassigned
              Reporter:
              rtomas Tomas Rawski
            • Votes:
              6 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development