Jump to content
Sign in to follow this  
AlanScottAgain

obb file location

Recommended Posts

Hi

 

Is there an equivalent  to TPath.GetHomePath for the obb directory?

 

I want to deploy some video files in an APK expansion pack. But not sure how to find where they will be installed to.

 

Thanks

Alan

Share this post


Link to post

see on  https://developer.android.com/google/play/expansion-files

The getObbDir() method returns the specific location for your expansion files in the following form:      <shared-storage>/Android/obb/<package-name>/

 

by Android Developers pages:  https://developer.android.com/training/data-storage/shared/documents-files

Quote

Access restrictions

On Android 11 (API level 30) and higher, you cannot use the ACTION_OPEN_DOCUMENT/ACTION_OPEN_DOCUMENT_TREE  intent action to request that the user select individual files from the following directories:

  • The Android/data/ directory and all subdirectories.
  • The Android/obb/ directory and all subdirectories.

maybe some like this (need test it in your environment)

 

function GetObbDir: string;
var
  AppContext: JContext;
  ObbDir    : JFile;
begin
  AppContext := TAndroidHelper.Context;             // SharedActivityContext;  // TJNativeActivity.Wrap(System.DelphiActivity);
  ObbDir     := AppContext.GetObbDir; { Delphi11 }  // before...  // ObbDir     := TJContextCompat.JavaClass.GetObbDir(AppContext);
  Result     := JStringToString(ObbDir.GetAbsolutePath);
end;

tested in Android11 + Delphi11 file:///storage/emulated/0/Android/obb/com.embarcadero.Project1

Edited by programmerdelphi2k

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×