Einzelnen Beitrag anzeigen

philipp.hofmann

Registriert seit: 21. Mär 2012
Ort: Hannover
860 Beiträge
 
Delphi 10.4 Sydney
 
#16

AW: Android: Zugriff auf externe Dateien (nicht Shareable media files) seit Delphi 10

  Alt 6. Mai 2021, 16:26
Ich habe über die beiden Varianten jetzt mal ein paar Minuten drüber geschaut und weiß noch nicht genau, wie sich dies mit Delphi umsetzen lässt:

1. Update your app to use more privacy friendly best practices, such as the Storage Access Framework or Media Store API
2. Update your app to declare the All files access (MANAGE_EXTERNAL_STORAGE) permission in the manifest file, and complete the All files access permission declaration in Play Console from May 5th

Wenn hier jemand ein Code-Beispiel hat, gerne her damit. Im Grundsatz geht es mir v.a. darum Dateien im SharedDownloads-Verzeichnis von Android abzulegen, da man dann im Browser darauf zugreifen soll.

3. Als Alternative wurde ja schon das Google-Drive angesprochen. Kann man das Google-Drive des angemeldeten Benutzers über einen Pfad einfach ansprechen (so wie es unter iOS funktioniert)?

Delphi-Quellcode:
    nsFile := TNSFileManager.Wrap(TNSFileManager.OCClass.defaultManager);

    URL:=nsFile.URLForUbiquityContainerIdentifier(nil);
    if (URL <> nil) then
    begin
      URL:=URL.URLByAppendingPathComponent(StrToNSStr('Documents'));
      Result := UTF8ToString(URL.path.UTF8String);
      if (not nsFile.fileExistsAtPath(URL.path,nil)) then
      begin
        mlog.info('create new iCloud directory: '+result);
        if (nsFile.createDirectoryAtURL(URL,true,nil,nil)) then
          mlog.info('Created new iCloud directory '+result)
        else
          mlog.info('Can´t creat new iCloud directory '+result);
      end;
    end else
      Result := '';
  Mit Zitat antworten Zitat