User home folder on samsung android device

1656
3
11-02-2016 03:29 PM
PaulHaakma
Regular Contributor

Hi all.

Am having an issue with accessing the user home folder on a Samsung Android device.

I've tested these variations:

AppFramework.userHomeFolder.path +  "/myFolder"
AppFramework.userHomePath +"/myFolder"
"~/myFolder"

They all seem to return the path of "/sdcard"

Then any attempt to create a folder fails with just a generic 'Error creating' message.

e.g.

FileFolder{
Component.Oncompleted{
if (!exists){makeFolder()}
}

The device doesn't have an sdcard in it. My question is, why is it returning the path of '/sdcard'?

As a comparison, Survey123 appears to use the "~/myFolder" approach, and works fine on this device. So I'm not sure why I'm experiencing a different result.

Using this:
AppFramework.standardPaths.standardLocations(StandardPaths.HomeLocation)[0] + "/myFolder"

Allows me to create a folder and get the app to work, but the location is not the location that Survey123 accesses, and is obviously not visible when I plug the device into a pc and try to browse the file system.


Any suggestions welcome.
Regards,
-Paul
0 Kudos
3 Replies
SathyaPrasad
Esri Contributor

Is this inside the player? if not then have you enabled the external storage permisssion?

0 Kudos
PaulHaakma
Regular Contributor

oh dear...... rookie mistake! Thanks Sathya, I even knew that but had completely forgotten.

Hopefully leaving this post here will keep someone else from asking the same question....!

Cheers,

-Paul

0 Kudos
StephenQuan1
Esri Contributor

Hi Paul, Survey123 has workFolder set to

    AppFramework.standardPaths.writableLocation(StandardPaths.TempLocation)

It seems you're already aware of standardPaths, for reference, here's a complete list:

var locations = {
  appData : AppFramework.standardPaths.standardLocations(StandardPaths.AppDataLocation),
  applications: AppFramework.standardPaths.standardLocations(StandardPaths.ApplicationsLocation),
  appLocalData : AppFramework.standardPaths.standardLocations(StandardPaths.AppLocalDataLocation),
  cache: AppFramework.standardPaths.standardLocations(StandardPaths.CacheLocation),
  config: AppFramework.standardPaths.standardLocations(StandardPaths.ConfigLocation),
  data: AppFramework.standardPaths.standardLocations(StandardPaths.DataLocation),
  desktop: AppFramework.standardPaths.standardLocations(StandardPaths.DesktopLocation),
  documents: AppFramework.standardPaths.standardLocations(StandardPaths.DocumentsLocation),
  download: AppFramework.standardPaths.standardLocations(StandardPaths.DownloadLocation),
  fonts: AppFramework.standardPaths.standardLocations(StandardPaths.FontsLocation),
  genericCache: AppFramework.standardPaths.standardLocations(StandardPaths.GenericCacheLocation),
  genericConfig: AppFramework.standardPaths.standardLocations(StandardPaths.GenericConfigLocation),
  genericData: AppFramework.standardPaths.standardLocations(StandardPaths.GenericDataLocation),
  home: AppFramework.standardPaths.standardLocations(StandardPaths.HomeLocation),
  movies: AppFramework.standardPaths.standardLocations(StandardPaths.MoviesLocation),
  music: AppFramework.standardPaths.standardLocations(StandardPaths.MusicLocation),
  pictures: AppFramework.standardPaths.standardLocations(StandardPaths.PicturesLocation),
  runtime: AppFramework.standardPaths.standardLocations(StandardPaths.RuntimeLocation),
  temp: AppFramework.standardPaths.standardLocations(StandardPaths.TempLocation)
};

-- Stephen