External Storage

>> So “externalStorage.getExternalFilesDir( “Download” )” [is] returning the right path now?

In my experiments, externalStorage.getExternalFilesDir(type) returns a string that is the end of the long path for that file (as eventually shown by Chrome in its URL box). It’s not clear to me how anyone can use the result of getExternalFilesDir.

For my application, all I want is the ability to copy a file to the device’s Download folder. When using the externalStorage.copyFile method, the path of “/Download/” was what I needed to make things work. Apparently Scott’s software expands “/Download/ “  to the longer path. It does that for a phone running Android 8.1 anyway.

For me, that leads to questions like: What version of Android is required for the externalStorage plugin?

Scott’s build instructions have a comment “Android > 6” However, on the phone I was using, Android 7 did not show the file that had been copied. It wasn’t until my phone received an update to Android 8.1 that the phone began showing files copied to “/Download/”

Should Scott now say that the externalStorage plugin requires Android 8.1 or greater, or do we think that’s only true for the phone I was experimenting with, a Motorola G5 plus?

To be more precise, should Scott now say the user must have Android 8.1 or greater to use the copyFile method of the the externalStorage plugin?

I tested on android 6.0 and copyFile seems to be working.

>> I tested on android 6.0

OK, I guess my Motorola G5 was lacking.

What phones do you test with (just so I’ll have more knowledge when my app gets into the field)?

I use a samsung j 3 and blu vivo 5 mini are my main test devices.

Thanks. I’ll see if I can get hold of a Nexus to try.

Hi Scott, I just bought your plugin. Thank you for your hard work.

json.encode( externalStorage.listFiles() --> gives me the list of files

json.encode( externalStorage.listFiles("/Music") --> doesn’t give me anything

The testing device is note9.

Try

json.encode( externalStorage.listFiles(“Music”)

I tried that already, the results are the same.

I also tried:

json.encode( externalStorage.listFiles(externalStorage.music))

Things are still good for me with this plugin, but then I got to thinking…

This plugin will have to be modified to a 64-bit version, correct ?

“We’re working on integrating this build system into Corona Simulator/Native and supporting existing plugins and settings”
https://coronalabs.com/blog/2019/05/28/corona-google-play-apps-and-64-bit/

Still waiting for more details but based on what corona said I believe not

Excellent. 

The part about “Simulator/Native” scares me a little bit. Does the slash mean "and or “or?” I guess I better learn more about Corona Native. I’ve been wanting to do that anyway. 

Thanks for the update!

When this is done, you will be able to build 64 bit apps with the simulator as well as Native. We will update Corona owned plugins and any dependencies. But third-party plugins will need to be recompiled to be 64 bit compliant. We don’t have the source for those plugins so we can’t do that.

Rob

Thanks Rob.

Awesome, will recompile my plugins when ever you guys official support 64 bit apps for android on simulator

@scott whilst you’re doing that can you take a look at Google Sign in as it is my number 1 source of ANRs.

(I’ve had it on my test devices too)

Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x50200010 (has extras) }

“GLThread 19063” prio=5 tid=11 Waiting

| group=“main” sCount=1 dsCount=0 flags=1 obj=0x13180998 self=0xe1ec2400
| sysTid=17506 nice=0 cgrp=default sched=0/0 handle=0xce080970
| state=S schedstat=( 0 0 0 ) utm=411 stm=35 core=6 HZ=100
| stack=0xcdf7e000-0xcdf80000 stackSize=1038KB
| held mutexes=
at java.lang.Object.wait (Native method)

  • waiting on <0x0c907d27> (a java.lang.Object)
    at java.lang.Thread.parkFor$ (Thread.java:2137)
  • locked <0x0c907d27> (a java.lang.Object)
    at sun.misc.Unsafe.park (Unsafe.java:358)
    at java.util.concurrent.locks.LockSupport.park (LockSupport.java:190)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:2059)
    at java.util.concurrent.LinkedBlockingQueue.take (LinkedBlockingQueue.java:442)
    at com.google.android.gms.common.BlockingServiceConnection.getService (unavailable)
    at com.google.android.gms.auth.zzg.zzd (unavailable)
    at com.google.android.gms.auth.zzg.zze (unavailable)
    at com.google.android.gms.auth.zzg.getToken (unavailable)
    at com.google.android.gms.auth.zzg.getToken (unavailable)
    at com.google.android.gms.auth.GoogleAuthUtil.getToken (unavailable)
    at plugin.googleSignIn.LuaLoader$silentSignIn.invoke (LuaLoader.java:411)
    at com.ansca.corona.JavaToNativeShim.nativeRender (Native method)
    at com.ansca.corona.JavaToNativeShim.render (JavaToNativeShim.java:220)
    at com.ansca.corona.Controller.updateRuntimeState (Controller.java:382)
  • locked <0x0c7fb74b> (a com.ansca.corona.Controller)
    at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame (CoronaGLSurfaceView.java:450)
    at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1625)
    at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1380)

This has been fixed

I tried to use plugin, but nothing worked. I decided to try, at least, get filelist of sdcard, using this code:

filePath.text = json.encode(externalStorage.listFiles(externalStorage.sdCardPath()))

but when I try to run it on my smartphone I get “Attempt to get length of null array”.

externalStorage.isSdCardConnected() gives me “true”
externalStorage.sdCardPath() gives me “/storage/3663-3834”

Also I decided to try this after getting the previous result:

filePath.text = json.encode(externalStorage.listFiles("/storage"))

and got the same error.

So what can be wrong? All permissions are given to the application. The name of test device is Xiaomi 6A, Android 8.1.0

Anyone here?
@scott are you creator of plugin? Can you help me?

I also tried to do externalStorage.listFiles("…") with paths, that shown in list of path “/” (for example “/Download”, and also tried only “Download”) but got an answer like “”. All, what can plugin do now, is to show listfile of “/” root and tell is sdcard connected, everything else is broken.

I have this is my notes to look at this weekend

Some update with my situation
Plugin works well, but only with main root “/” and with files, located directly in this root
But subfolders (and, of course, sdcard, because it’s path in subfolder too) are broken