This is a migrated thread and some comments may be shown as answers.

Storage Access Framework from NativeScript

5 Answers 212 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dimitar
Top achievements
Rank 1
Dimitar asked on 30 Aug 2017, 04:29 PM

Hi, 

Is there a plugin for NativeScript using and accessing the Android Storage Access Framework . Needed for browsing and selecting file .

 

5 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Tsonev
Telerik team
answered on 31 Aug 2017, 05:21 AM
Hello Dimitar,

For described scenario, I could suggest using nativescript-file-picker plugin, which provides similar functionality. For further help, you could also review the plugin's repository here.


Let me know, whether this is applicable for you.

Regards,
nikolay.tsonev
Progress Telerik
Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
0
Dimitar
Top achievements
Rank 1
answered on 31 Aug 2017, 01:33 PM

actually as I see I could simple do 

let intent = new android.content.Intent() ;
 
      intent.setType("image/*");
       
      intent.setAction(android.content.Intent.ACTION_GET_CONTENT);
      intent.addCategory(android.content.Intent.CATEGORY_OPENABLE);
       
     app.android.foregroundActivity.startActivityForResult(intent,42) ;
0
Dimitar
Top achievements
Rank 1
answered on 31 Aug 2017, 01:58 PM

actually the code which I have psoted in previous post is open the native android picker , but I am not sure how this android override needed result should  be added by nativescript 

@Override
public void onActivityResult(int requestCode, int resultCode,
        Intent resultData) {
    if (requestCode == 42 && resultCode == Activity.RESULT_OK) {
              Uri uri = null;
        if (resultData != null) {
            uri = resultData.getData();
            Log.i(TAG, "Uri: " + uri.toString());
            showImage(uri);
        }
    }
}

 

0
Dimitar
Top achievements
Rank 1
answered on 31 Aug 2017, 02:37 PM
I found  way with code : 
app.android.on(app.AndroidApplication.activityResultEvent, function (args: app.AndroidActivityResultEventData) {
       console.log("Event: " + args.eventName + ", Activity: " + args.activity +
           ", requestCode: " + args.requestCode + ", resultCode: " + args.resultCode + ", Intent: " + args.intent);

 

 

0
Nikolay Tsonev
Telerik team
answered on 01 Sep 2017, 05:36 AM
Hello,

I glad to hear that you have found a way to handle the response from the Android file picker.
I tested the attached code and it seems to work as expected and to returns correct path to the selected file.

Let me know if I could assist you further.

Regards,
nikolay.tsonev
Progress Telerik
Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
Tags
General Discussion
Asked by
Dimitar
Top achievements
Rank 1
Answers by
Nikolay Tsonev
Telerik team
Dimitar
Top achievements
Rank 1
Share this question
or