Recent

Author Topic: Get path to SDcard  (Read 3216 times)

jarex

  • Newbie
  • Posts: 1
Get path to SDcard
« on: December 31, 2016, 11:31:55 am »
Please is possible get path to external and internal storage? with pascal. Thank you.

tk

  • Sr. Member
  • ****
  • Posts: 388
Re: Get path to SDcard
« Reply #1 on: January 03, 2017, 08:47:34 pm »
If you mean the path to save your app preferences then use GetAppConfigDir.
It works correctly in FPC trunk.

If you mean paths returned by Java Environment class methods (https://developer.android.com/reference/android/os/Environment.html) then AFAIK it is not yet accessible either through FPC RTL or through LAMW. For LAMW it would need another component which would encapsulate the Environment class.

Another option is to use hard coded paths, usable of course only for your private project. On my device:
primary card: /storage/sdcard0/
external card: /storage/extSdCard/

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Get path to SDcard
« Reply #2 on: January 04, 2017, 11:05:49 am »
You can obtain via JNI, but the Java code that I found to do it is pretty large, so this means an even larger amount of JNI will be needed.

Anyway, you can do this via JNI, examples here: http://wiki.lazarus.freepascal.org/Android_Programming#Android_JNI

Search for the Java code to do it and convert the Java to JNI.

 

TinyPortal © 2005-2018