Android Question Path to GetSafeDirDefaultExternal

Roger C

Active Member
Licensed User
Longtime User
Hi all,
probably something I totally forgot but...

When I use the code below I end up in the path:
Android\data\b4a.example\files
(or rather: /storage/emulated/0/Android/data/b4a.example/files)
If I look in that folder I find the textfile.

But I don't want to use b4a.exemple instead I wan't my appname there.
How do I do that?

B4X:
Starter.AppDirectoryExt = rp.GetSafeDirDefaultExternal("")
    Log("ActivityCreate. GetSafeDirDefaultExternal = " & Starter.AppDirectoryExt)
    File.WriteString(Starter.AppDirectoryExt, "3.txt", "aaa")

I've changed the Label in the Attributes:
B4X:
#Region  Project Attributes
    #ApplicationLabel: SL Claim
    #VersionCode: 1
    #VersionName:
.......


If above is not possible, must I use DirRootExternal and create my own folder and save everything there?

I want the saved files to exist there when app is updated, if app is deleted (if it is reinstalled the data should still be there) and the data should also be available through a file-explorer in the phone or when connected to a computer.
 

DonManfred

Expert
Licensed User
Longtime User
STRG-B, Change the Packagename from b4a.exemple to com.yourcompany.yourapp for ex.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Hi.
Has anything changed when it comes to the package name? Why three parts?

It's not a requirement to have 3 parts in a package name (you must have at least 2), but the general recommendation is to use a "reverse domain name" format so that it's unique (all package names have to be unique). I always use com.airlinemates.[appname] for mine - because I own the domain airlinemates.com, so I'm reasonably confident that my package names will be unique. There are some rules (from https://developer.android.com/studio/build/application-id):

  • It must have at least two segments (one or more dots).
  • Each segment must start with a letter.
  • All characters must be alphanumeric or an underscore [a-zA-Z0-9_].

- Colin.
 
Upvote 0
Top