Jump to content

radekc

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by radekc


  1. If you want, you can use great mime decoder from synapse, works with binary data in mime

     

    use mimepart, mimemess, synautil

     

              oStream := TMemoryStream.Create;
              ARequestInfo.PostStream.Position := 0;
              oStream.LoadFromStream(ARequestInfo.PostStream); //<-------  Indy Post stream
              oStream.Position := 0;
              mime := TMimeMess.Create;
              mime.DecodeMessageBinary(ARequestInfo.RawHeaders, oStream);
              if mime.MessagePart = nil then
              begin
                LogErrorFmt('Invalid HTTP mime in POST ', [], False);
                Exit;
              end;
              //sData := mime.MessagePart.GetSubPartCount.ToString;
              LogInfo(Format('Found parts:%d in mime data ', [mime.MessagePart.GetSubPartCount]));
              for iParts := 0 to mime.MessagePart.GetSubPartCount - 1 do
              begin
                mimepart := mime.MessagePart.GetSubPart(iParts);
                LogInfo(Format('Found part: %s, %s ', [mimepart.FileName, mimepart.Primary+'-'+mimepart.Secondary]));
                sExt := ExtractFileExt(mimepart.FileName);
                if (sExt = '.json')  then
                begin
                  mimepart.DecodePart;
                  sData := ReadStrFromStream(mimepart.DecodedLines, mimepart.DecodedLines.Size);
                end;
              end;

     


  2. IF you want use EXTERNAL_MANAGE_STORAGE and use same code as before (on Android 13 required, introduced in Android 11), your user must enable all access, you can invoke dialog with this code  (working code based on Kastri library)
     

    class function TMainForm.NeedsAllFilesAccessPermission: Boolean;
    begin
      Result := TOSVersion.Check(11) and not TJEnvironment.JavaClass.isExternalStorageManager;
    end;
    
    class function TMainForm.ShowAllFilesAccessPermissionSettings: Boolean;
    var
      LIntent: JIntent;
      LUri: Jnet_Uri;
      LAction: JString;
    begin
      Result := False;
      if NeedsAllFilesAccessPermission then
      begin
        LUri := TJnet_Uri.JavaClass.fromParts(StringToJString('package'), TAndroidHelper.Context.getPackageName, nil);
        LAction := StringToJString('android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION');
        LIntent := TJIntent.JavaClass.init(LAction, LUri);
        TAndroidHelper.Context.startActivity(LIntent);
        Result := True;
      end;
    end;

     


  3. Hi,

    I wrapped 3rd party JView java component with class based on TAndroidNativeView, but now I am lost. Everything is created, dynamic library from 3rd party is loaded (debugger is show it), I can call methods, but how I show it on form or on layout?

    I see created parent Layout in TAndroidNativeView, but how I parent this layout with FMX? I looked in FMX in Android MapView, but I don't know.

     


  4. and after some battle and fixed resources I get run-time error
    java.lang.BootstrapMethodError: Exception from call site #2 bootstrap method

    every solution on web recommended for Android studio

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
     
    but what about Delphi?
     
×