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:
(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?

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

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

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.


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


Well-Known Member
Licensed User
Longtime User
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, so I'm reasonably confident that my package names will be unique. There are some rules (from

  • 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