GetSpecialFolder external (Android 10 Go)

158 views
Skip to first unread message

Alan Hendry

unread,
Feb 8, 2021, 7:27:15 AM2/8/21
to DroidScript
Hi,
On Android 10 DS SPK I try to create an image in an external special folder
I've tried with option external and External
The alert shows /storage/emulated/0/DCIM/gsfe.jpg
The Go FileManager shows the image is in internal > DCIM
Regards, ah
    img = app.CreateImage( null, 1, 1 );
    img.SetPaintColor( "green" );
    img.DrawCircle( 0.5, 0.5, 0.3 );

    f = app.GetSpecialFolder( "DCIM","external" );
    app.MakeFolder( f );
    f += "/gsfe.jpg" ;
    img.Save( f );
    alert( f)

Steve Garman

unread,
Feb 8, 2021, 8:09:42 AM2/8/21
to DroidScript
As far as I (and the Docs) know app.GetSpecialFolder does not take a second argument called "options" or anything else

External is a very confusing word in Android because for historical reasons it always used to point to internal storage

Where exactly are you trying to write to? Please note that the term "external special folder" means nothing to me

Alan Hendry

unread,
Feb 8, 2021, 12:07:02 PM2/8/21
to DroidScript
Steve,
Mea culpa, mea culpa, mea maxima culpa.
I meant GetPrivateFolder
Ultimately I want to take photos to the internal card and external card with SPK and APK and scan to Gallery in Android 10 and earlier.
So far, only  app.GetInternalFolder() +"/scanfile"  seems to work - SPK only
Regards, ah 
 
function OnStart()
{
    img = app.CreateImage( null, 1, 1 );
    img.SetPaintColor( "green" );
    img.DrawCircle( 0.5, 0.5, 0.3 );
    
    f = app.GetPrivateFolder() ;
    app.MakeFolder( f );
    f += "/gpf.jpg" ;
    img.Save( f );
    app.ScanFile( f ) ;
    alert(f)
 
    f = app.GetPrivateFolder( "Pictures");
    app.MakeFolder( f );
    f += "/gpfp.jpg" ;
    img.Save( f );
    app.ScanFile( f ) ;
    alert(f)
    
    f = app.GetPrivateFolder( "Pictures","external" );
    app.MakeFolder( f );
    f += "/gpfpe.jpg" ;
    img.Save( f );
    app.ScanFile( f ) ;
    alert(f) 
     
    f = app.GetInternalFolder() +"/scanfile" ;
    app.MakeFolder( f );
    f += "/gif.jpg" ;
    img.Save( f );
    app.ScanFile( f ) ;
   
}

Alan Hendry

unread,
Feb 16, 2021, 5:12:14 AM2/16/21
to DroidScript
Hi,
I've now expanded my code to include writing to Path and AppPath and relative.
When I build and run on Android 10 Go, none of them seem to write the image and scan it.
(even if I wait a minute to make sure it has had time to write the files, then run it again to scan them). 
Regards, ah

Alan Hendry

unread,
Mar 22, 2021, 8:22:43 AM3/22/21
to DroidScript
Hi,
Android 10 (Go) is (in popular parlance) doing my head in.
I've tried writing to and scanning different folders (Private, Internal, External, Path, AppPath, Special, relative).
It seems to write to GetPrivateFolder() and GetPrivateFolder("PIctures"), but they aren't visible in the File Manager.
It also writes to GetPrivateFolder("Pictures","External") to Internal>Android>data>package-name>files>Pictures which is visible.
But none of them are scanned into the Go Gallery (even after rebooting the phone).
All the other folders don't seem to write the file.
I reckon "/Storage/" is mapped to Internal>Android>data>package-name, 
but code to write to "/Storage/files/Pictures/ss.jpg" doesn't seem to create the file.
Regards, ah

Reply all
Reply to author
Forward
0 new messages