cordova-ourcodeworld-filebrowser icon indicating copy to clipboard operation
cordova-ourcodeworld-filebrowser copied to clipboard

Plugin not returning the selected file

Open premtemp1 opened this issue 8 years ago • 8 comments

Hello, Thanks for the plugin but I cannot get it to work.. I see the filechooser and I can select a file. However , the file is not returned ..

I see this error in the android console W/CordovaInterfaceImpl: Got an activity result, but no plugin was registered to receive it.

Can you provide some suggestion and how to fix it..

I am using cordova version 6.3.1.. Android SDK 22

Thanks

premtemp1 avatar Nov 16 '16 15:11 premtemp1

Hey @premtemp1 , thanks for test the plugin. Could you provide the JS that you're using?

sdkcarlos avatar Nov 16 '16 16:11 sdkcarlos

Thanks for looking in to it.. As noted earlier, I see the UI and the files but it seems like the callback is not getting fired after I select a file

Here the JS .. On click action.

` $scope.chooseFile = function () { window.OurCodeWorld.Filebrowser.filePicker.single({ success: function (data) { alert('sucess call back'); alert('data'); if (!data.length) { alert('No file selected'); return; } }, error: function (err) { alert(err); console.log(err); } });

}; `

-- Android console output -- W/No activity found to handle file chooser intent.: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.GET_CONTENT cat=[android.intent.category.OPENABLE] typ=.doc,.docx,.rdf,.txt,.pdf,.odt } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1798) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512) at android.app.Activity.startActivityForResult(Activity.java:3917) at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:332) at android.app.Activity.startActivityForResult(Activity.java:3877) at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:67) at org.apache.cordova.engine.SystemWebChromeClient.onShowFileChooser(SystemWebChromeClient.java:268) at com.android.webview.chromium.WebViewContentsClientAdapter.showFileChooser(WebViewContentsClientAdapter.java:1104) at org.chromium.android_webview.AwWebContentsDelegateAdapter.runFileChooser(AwWebContentsDelegateAdapter.java:219) at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae536b70 W/CordovaInterfaceImpl: Got an activity result, but no plugin was registered to receive it. W/CordovaInterfaceImpl: Got an activity result, but no plugin was registered to receive it. I/chromium: [INFO:CONSOLE(556)] "RESUME EVENT!", source: file:///android_asset/www/app/app.module.js (556) E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae5322d0

-- end android console --

The android manifest has the permission uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"

And the cordova config.xml file has the value

engine name="android" spec="~5.2.2" plugin name="com.ourcodeworld.plugins.Filebrowser" spec="https://github.com/ourcodeworld/cordova-ourcodeworld-filebrowser.git"

Please let me know if you need any other information,,, Sorry but I cannot send you the project

Thanks for the help

premtemp1 avatar Nov 16 '16 16:11 premtemp1

@premtemp1 Cannot reproduce on emulator [Android 5.1.1 (API22)] with the following code on an new empty project:

window.OurCodeWorld.Filebrowser.filePicker.single({
    success: function(data) {
        alert('sucess call back');// is triggered ...
        if (!data.length) {
            alert('No file selected');
            return;
        }

        console.log(data);
    },
    error: function(err) {
        alert(err);
        console.log(err);
    }
});

:(

sdkcarlos avatar Nov 18 '16 16:11 sdkcarlos

Thank you for your help ..

Sorry... I made a mistake on the version.. I

Cordova 6.3.1 , android 5.2.2 and APK 23

What is your version of cordova?

Are there any addition setting you have to do in the manifest file? is it possible to see if it works for you on the new versions...

Thank you very much

premtemp1 avatar Nov 18 '16 16:11 premtemp1

can you please send me the test cordova project.. I can try it in my environment...

I tried to debug today but was not able to make any progress. I see that the OK button logic is getting trigger and the selected file is store in the object. However, it does not seem to be returning to the callback function

Thanks

premtemp1 avatar Nov 18 '16 16:11 premtemp1

@sdkcarlos, Hey,,, just checking to see if you were able to get you plugin to work with[Cordova 6.3.1 , android 5.2.2 and APK 23] and if you can send your working example to me...

Thanks

premtemp1 avatar Nov 29 '16 11:11 premtemp1

Hello

just checking to see if you were able to get you plugin to work with[Cordova 6.3.1 , android 5.2.2 and APK 23] and if you can send your working example to me...

premtemp1 avatar Feb 14 '17 01:02 premtemp1

Thank you plugin but i have always problem when i remove platform android and add there are some problem with this plugin failed to download com.ourcodeworld.plugin.FileBrowser and no file or directory in Androidmanifest.xml for android version 7

rushabh789 avatar Apr 26 '18 11:04 rushabh789