Jump to content

Ruslan

Members
  • Content Count

    46
  • Joined

  • Last visited

Community Reputation

5 Neutral

About Ruslan

  • Birthday 12/30/1979

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ruslan

    Firebird database on Android

    I don't think you could install a FirebirdSQL server on an Android, but you can use FirebirdSQL Database in embedded mode, that way you don't need to install Firebird on android device and use only the library, e.g. you will have 2 files, one is the database and one is the library.
  2. I need to open application periodically every minute. For testing I have a simple application with just this code that should open the application: function getTimeAfterInSecs(Seconds: Integer): Int64; var Calendar: JCalendar; begin Calendar := TJCalendar.JavaClass.getInstance; Calendar.add(TJCalendar.JavaClass.SECOND, Seconds); Result := Calendar.getTimeInMillis; end; procedure TForm2.Button1Click(Sender: TObject); var Intent: JIntent; PendingIntent: JPendingIntent; LFlags: Integer; begin Intent := TJIntent.Create; Intent.setClassName(TAndroidHelper.Context, StringToJString('com.embarcadero.firemonkey.FMXNativeActivity')); LFlags := TJPendingIntent.JavaClass.FLAG_UPDATE_CURRENT or TJPendingIntent.JavaClass.FLAG_IMMUTABLE; PendingIntent := TJPendingIntent.JavaClass.getActivity(TAndroidHelper.Context, 1, Intent, LFlags); TAndroidHelper.AlarmManager.&set(TJAlarmManager.JavaClass.RTC_WAKEUP, getTimeAfterInSecs(60), PendingIntent); end; procedure TForm2.Button2Click(Sender: TObject); var Intent: JIntent; PendingIntent: JPendingIntent; LFlags: Integer; AlarmManager: JAlarmManager; begin Intent := TJIntent.Create; Intent.setClassName(TAndroidHelper.Context, StringToJString('com.embarcadero.firemonkey.FMXNativeActivity')); LFlags := TJPendingIntent.JavaClass.FLAG_UPDATE_CURRENT or TJPendingIntent.JavaClass.FLAG_IMMUTABLE; PendingIntent := TJPendingIntent.JavaClass.getActivity(TAndroidHelper.Context, 0, Intent, LFlags); AlarmManager := TJAlarmManager.Wrap(TAndroidHelper.Context.getSystemService(TJContext.JavaClass.ALARM_SERVICE)); AlarmManager.setExactAndAllowWhileIdle(TJAlarmManager.JavaClass.RTC_WAKEUP, getTimeAfterInSecs(60), PendingIntent); end; Unfortunately the application does not open. What am I doing wrong?
  3. Look at OpenCV, it's not a component but a very good library. Didn't used it in Delphi, only in C/C++ and Python.
  4. Did you try to change the fbclient library? In you example I suppose you are using the v3.
  5. Ruslan

    Looking for License Plate Recognition library

    You could look at https://github.com/ria-com/nomeroff-net . Some time ago I've developed a number plate recognition module for a large project.
  6. Ruslan

    Make calls from app and get status

    Hi all and Happy Holidays! Can anyone guide me how to use Kastri or native FMX for making and receiving calls from application? Also I need a method to control the calling process, eg to terminate the call after some seconds, and to get statuses (logs) for those calls (answered, no answer, invalid number, or any type of calling results). I've started with PhoneDialer example that came with Delphi, and tried to use smth like following example but can't get statuses. procedure TPhoneDialerForm.FormCreate(Sender: TObject); begin {$IFDEF ANDROID} FCallPhonePermission := JStringToString(TJManifest_permission.JavaClass.CALL_PHONE); FReadPhoneStatePermission := JStringToString(TJManifest_permission.JavaClass.READ_PHONE_STATE); FReadCallLogPermission := JStringToString(TJManifest_permission.JavaClass.READ_CALL_LOG); FManageOwnCalls := JStringToString(TJManifest_permission.JavaClass.MANAGE_OWN_CALLS); FBindTelecomService := JStringToString(TJManifest_permission.JavaClass.BIND_TELECOM_CONNECTION_SERVICE); //FReadPrecisePhoneState := JStringToString(TJManifest_permission.JavaClass.READ_PRECISE_PHONE_STATE); {$ENDIF} { test whether the PhoneDialer services are supported } TPlatformServices.Current.SupportsPlatformService(IFMXPhoneDialerService, FPhoneDialerService); PermissionsService.RequestPermissions([FCallPhonePermission,FReadPhoneStatePermission,FReadCallLogPermission,FManageOwnCalls,FBindTelecomService], procedure (const APermissions: TClassicStringDynArray; const AGrantResults: TClassicPermissionStatusDynArray) begin if (Length(AGrantResults) = 5) and (AGrantResults[0] = TPermissionStatus.Granted) and (AGrantResults[1] = TPermissionStatus.Granted) and (AGrantResults[2] = TPermissionStatus.Granted) and (AGrantResults[3] = TPermissionStatus.Granted) and (AGrantResults[4] = TPermissionStatus.Granted) then begin ShowMessage('Permissions Activated!'); end; end ); FPhoneDialerService.OnCallStateChanged := CallStateChanged; end; procedure TPhoneDialerForm.CallStateChanged(const ACallID: string; const AState: TCallState); var Calls: TCalls; Call: TCall; begin case AState of TCallState.None: begin lbCalls.Items.Add(Format('%-16s %s', [ACallID, CallStateAsString(AState)])); end; TCallState.Connected: begin lbCalls.Items.Add(Format('%-16s %s', [ACallID, CallStateAsString(AState)])); end; TCallState.Incoming: begin Calls := FPhoneDialerService.GetCurrentCalls; try for Call in Calls do begin if Call.GetCallID = ACallID then begin lbCalls.Items.Add(Format('%-16s %s', [ACallID, CallStateAsString(AState)])); Exit; end; end; finally for Call in Calls do Call.Free; end; end; TCallState.Dialing: begin lbCalls.Items.Add(Format('%-16s %s', [ACallID, CallStateAsString(AState)])); end; TCallState.Disconnected: begin lbCalls.Items.Add(Format('%-16s %s', [ACallID, CallStateAsString(AState)])); end; end; end; function TPhoneDialerForm.CallStateAsString(AState: TCallState): String; begin case AState of TCallState.None: Result := 'None'; TCallState.Connected: Result := 'Connected'; TCallState.Incoming: Result := 'Incoming'; TCallState.Dialing: Result := 'Dialing'; TCallState.Disconnected: Result := 'Disconnected'; else Result := '<unknown>'; end; end; For the calling method I used these // Default method from example procedure TPhoneDialerForm.btnMakeCallClick(Sender: TObject); begin { test whether the PhoneDialer services are supported } if FPhoneDialerService <> nil then begin { if the Telephone Number is entered in the edit box then make the call, else display an error message } if edtTelephoneNumber.Text <> '' then begin PermissionsService.RequestPermissions([FCallPhonePermission], MakePhoneCallPermissionRequestResult, DisplayRationale) //FPhoneDialerService.Call(edtTelephoneNumber.Text); end else begin TDialogService.ShowMessage('Please type in a telephone number.'); edtTelephoneNumber.SetFocus; end; end else TDialogService.ShowMessage('PhoneDialer service not supported'); end; procedure TPhoneDialerForm.MakePhoneCallPermissionRequestResult(Sender: TObject; const APermissions: TClassicStringDynArray; const AGrantResults: TClassicPermissionStatusDynArray); begin // 1 permission involved: CALL_PHONE if (Length(AGrantResults) = 1) and (AGrantResults[0] = TPermissionStatus.Granted) then FPhoneDialerService.Call(edtTelephoneNumber.Text) else TDialogService.ShowMessage('Cannot make a phone call because the required permission has not been granted'); end; // The other method for making calls procedure TPhoneDialerForm.MakeCall(const PhoneNumber: string); var Intent: JIntent; Uri: Jnet_Uri; begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_CALL); Uri := TJnet_Uri.JavaClass.parse(StringToJString('tel:' + PhoneNumber)); Intent.setData(Uri); if TAndroidHelper.Activity.getPackageManager.queryIntentActivities(Intent, 0).size > 0 then TAndroidHelper.Activity.startActivity(Intent) else ShowMessage('No app to handle the call intent.'); end;
  7. For communication between apps/processes I used to use Redis Message Queue to send some signals between them or to send data. But I didn't use that way in Delphi yet (planning to). I agree with splitting GUI from the working code, for that I've chose MVVM pattern (ChatGPT gave me some examples but Grijji has a nice framework).
  8. Ruslan

    Delphi accessing remote Derby DB

    Also make sure that windows firewall doesn't block remote connection to the db.
  9. I'd better create a vpn server on the cloud to create a virtual LAN between 3 of your environments.
  10. Ruslan

    Error while installing fastreport

    Did you try to install it via GetIt? If so that try to clear the previous downloaded packages of Fastreport, then try to to install it again but running the IDE with administration rights (Run As Administrator).
  11. Ruslan

    What is proper way to crypt some fields?

    There is a way to encrypt the Firebird database, the is a sample in Firebird documentation. Unlucky me I wasn't able to create a encryption/decryption module for Firebird, most because of no time, maybe you could try to create one and share the results and will have a lot of thanks and appreciations for that. Most encryption/decryption modules prices are tooo big.
  12. I would capture that content (on exception of course) and will try to parse it for content that describes the error and display it to the user. But first I would try to collect all types of errors/html and create some kind of templates to make it easier for parser (from above) to get the right content.
  13. Ruslan

    Firebird transactions with Firedac

    SET SQL DIALECT 3; CREATE GENERATOR GEN_RECORD_NUMBER; SET TERM ^ ; CREATE OR ALTER TRIGGER ORDEN_BI FOR ORDEN ACTIVE BEFORE INSERT POSITION 0 as begin if ((new.number is null) or (new.number = 0)) then new.number = gen_id(GEN_RECORD_NUMBER,1); if ((new.guid is null) or (trim(new.guid) = '') ) then new.guid = '{' || uuid_to_char( gen_uuid() ) || '}'; end ^ SET TERM ; ^ I also use a GUID column as a unique field
  14. Ruslan

    SOAP Client debug

    Delphi 10.3.3 SOAP Server (unknown source but the server has it's a php) Imported the wsdl, no changes made to the unit. Tested requests to the server with SoapUI and everything goes fine, from Delphi application - there is no luck. All responses are about Schema mismatch. Using event HTTPRio.onBeforeExecute checked the request and it is the same as tested in SoapUI. Questions: How to debug a request? How to check if the request meets the schema rules? Any advanced docs/video on how to build SOAP client/server applications?
×