Android Question Path to GetSafeDirDefaultExternal

Discussion in 'Android Questions' started by Roger C, May 7, 2019.

  1. Roger C

    Roger C Active Member Licensed 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?

    Code:
    Starter.AppDirectoryExt = rp.GetSafeDirDefaultExternal("")
        
    Log("ActivityCreate. GetSafeDirDefaultExternal = " & Starter.AppDirectoryExt)
        
    File.WriteString(Starter.AppDirectoryExt, "3.txt""aaa")
    I've changed the Label in the Attributes:
    Code:
    #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.
     
  2. DonManfred

    DonManfred Expert Licensed User

    STRG-B, Change the Packagename from b4a.exemple to com.yourcompany.yourapp for ex.
     
    Erel and Roger C like this.
  3. Roger C

    Roger C Active Member Licensed User

    Ahhh. Thank you!!!!
    I knew there was a place. You saved my evening. :)
    But I will try with CTRL ;)
     
  4. DonManfred

    DonManfred Expert Licensed User

    sorry, this is the difference between your language and my (german).. On a german keyboard CTRL is named STRG
    and honestly i didn´t thought about translating it ;-)
     
    jimmyF and Computersmith64 like this.
  5. Roger C

    Roger C Active Member Licensed User

    No problem. I've read german for 5 years (a looooooong time ago) so I recognized it :)
     
    DonManfred likes this.
  6. Roger C

    Roger C Active Member Licensed User

    Works perfect. Thanks.
     
  7. kisoft

    kisoft Active Member Licensed User

    Hi.
    Has anything changed when it comes to the package name? Why three parts?
     
  8. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    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):

    - Colin.
     
    jimmyF and José J. Aguilar like this.
  9. kisoft

    kisoft Active Member Licensed User

    OK.
    Thank you for your response.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice