Recent

Author Topic: How to get path to shared documents folder or main storage folder?  (Read 2319 times)

Atak_Snajpera

  • New Member
  • *
  • Posts: 10
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.  
« Last Edit: November 28, 2021, 01:41:43 pm by Atak_Snajpera »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2053
Re: How to get path to shared documents folder or main storage folder?
« Reply #1 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)?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018