Lazarus

Programming => Operating Systems => Android => Topic started by: Atak_Snajpera on November 28, 2021, 01:07:45 pm

Title: How to get path to shared documents folder or main storage folder?
Post by: Atak_Snajpera on November 28, 2021, 01:07:45 pm
My applications has to store some gps coordinates in plain txt file. Those files must be easily accessible by user so I was thinking about Documents folder. Unfortunately  TEnvDirectory for function GetEnvironmentDirectoryPath does not have dirDocuments or dirSharedDocuments! I could always use hardcoded path like /storage/emulated/0/Documents/ but that might not be the best idea for future.
Code: Pascal  [Select][+][-]
  1. TEnvDirectory = (dirDownloads,
  2.                     dirDCIM,
  3.                     dirMusic,
  4.                     dirPictures,
  5.                     dirNotifications,
  6.                     dirMovies,
  7.                     dirPodcasts,
  8.                     dirRingtones,
  9.                     dirSdCard,
  10.                     dirInternalAppStorage,
  11.                     dirDatabase,
  12.                     dirSharedPrefs,
  13.                     dirCache);  
  14.  
Title: Re: How to get path to shared documents folder or main storage folder?
Post by: jmpessoa on November 28, 2021, 05:46:55 pm
Quote
Unfortunately  TEnvDirectory for function GetEnvironmentDirectoryPath does not have dirDocuments...

Yes, Unfortunately the android "Documents" folder need API > 19 ....

but, as side note, there is an increasing android restriction for your application to actually have access to these "public" folders....

What about "jPreference" component  (Extra Tab)?
TinyPortal © 2005-2018