Jump to content

ertank

Members
  • Content Count

    232
  • Joined

  • Last visited

Everything posted by ertank

  1. ertank

    Changing label text in thread leads to weird display

    Do I still need to do such protection for reading only? Thread will be the only process which is writing into a string variable.
  2. ertank

    Delphi 10.3.3 has been released

    I did not have any problem using web installer for several versions now. My 10.3.2 was a web installer installed. I choose not to remove all registry settings when asked. Installer first uninstalled 10.3.2 and after installed 10.3.3 just fine. I did not have to re-install any of my components except Ide FixPack. You better have a fast internet connection for web installer, let it install over night or something similar though.
  3. Hello, I have found that stackoverflow code of @David Heffernan https://stackoverflow.com/questions/4354071/how-can-i-allow-a-form-to-accept-file-dropping-without-handling-windows-messages Attached is a project where I put it all together for my use case. However, it seems to leak some memory. I do not know why but TForm2.DestroyWnd seems not executed at all. I simply run and close the application without doing anything. Below dialog is my leak report message Any help is appreciated. Thanks & regards, Ertan DragDrop.7z
  4. ertank

    Overrided TForm.DestroyWnd is not executed

    That did solve my problem.
  5. ertank

    Overrided TForm.DestroyWnd is not executed

    I do debug run and execution does not stop at first line of DestroyWnd procedure at all.
  6. Maybe you can run two threads? Something like your thread-1 does the loop. Upon a variable trigger or a procedure call, thread-1 runs the possibly never ending code in thread-2. After that thread-1 checks if that thread-2 terminates in a given time limits. If there is a timeout, your main app can provide a feedback to user and maybe an option to re-start the app or something.
  7. I have CE and it works on in it.
  8. I started an Android project and did not give its package name a proper name. Now project is almost finished and remember to provide it a proper package name before releasing. - I changed the package name. - I removed installed app on my test phone. - Restarted the phone. - Tried to install same app with a new package name. That simply failed and displayed a window with "Unable to create process: Unable to install '<path>'. Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]" I believe I need to do more, but do not know what exactly. Google searches are not helpful. Most likely I am not choosing correct words. This has happened to me before and I did not solve it properly back then (changed package name back to default). I want to learn the way to do it right, now. Any help is appreciated. Thanks & regards, Ertan
  9. ertank

    Unable to install app after package name change

    It turned out to be a problem of package name. Android does not like domain names starting with numbers like "com.1stlevel.mypackage_name" However, converting numbers to letters works just fine like "com.firstlevel.mypackage_name".
  10. ertank

    Mac address on Android 6.0 or above

    Thank you. I have just slightly modified provided code to my taste and get rid of "deprecated" message for JObjectToID on Delphi 10.3.2. Final working for me version is below. uses System.SysUtils, Androidapi.JNI, Androidapi.JNI.Java.Net, Androidapi.JNI.JavaTypes, Androidapi.Helpers, Androidapi.JNIBridge; function BytesToHex(const ABytes: TBytes): string; var I: Integer; begin Result := EmptyStr; for I := Low(ABytes) to High(ABytes) do Result := Result + IntToHex(ABytes[I], 2) + ':'; SetLength(Result, Result.Length - 1); end; function GetMacAddress(const InterfaceName: string = 'wlan0'): string; var LInterfaces: JEnumeration; LInterface: JNetworkInterface; LJavaBytes: TJavaArray<Byte>; LBytes: TBytes; I: Integer; begin Result := EmptyStr; LInterfaces := TJNetworkInterface.JavaClass.getNetworkInterfaces; while LInterfaces.hasMoreElements do begin LInterface := TJNetworkInterface.Wrap(TAndroidHelper.JObjectToID(LInterfaces.nextElement)); if JStringToString(LInterface.getName).ToLower().Equals(InterfaceName) then begin LJavaBytes := LInterface.getHardwareAddress; if LJavaBytes <> nil then begin SetLength(LBytes, LJavaBytes.Length); for I := 0 to LJavaBytes.Length - 1 do LBytes[I] := LJavaBytes.Items[I]; Result := BytesToHex(LBytes); Exit(); end; end; end; end; It seems Mac address is still way to go. At least for a while.
  11. Hello, When I work on forms I have Style selection on screen. When I work on Frames, I do not see that Style selection and it always sticks to Windows Style even if my target is selected as Android. This makes it difficult to position some screen components. Is this a known problem or a feature of frames? Can I have platform specific design in a way with frames? Thanks & regards, Ertan
  12. ertank

    FMX Platform Frame design

    Thank you for clarifying situation about frames and pointing out an alternative solution. Alternative solution seemingly easy to implement. Unfortunately, I cannot switch my entire app into this now.
  13. Hello, I am using Delphi 10.3.2. There is an app for Android 5.1.1 platform only. It was working good. I do not remember when actually, but it was fine for sure. Problem now is that I get segmentation fault 11 when application is terminating. I cannot find in code reason why. I get following error in debugger after running Application.Terminate() or using Android back button which closes app: First chance exception at $00000000. Exception class Segmentation fault (11). Process Project1.apk (9547) Execution stops in System.pas at following lines: function _InstClear(var Dest: TObject): Pointer; {$IFDEF PUREPASCAL} var P: Pointer; begin Result := @Dest; if Dest <> nil then begin P := Pointer(Dest); Pointer(Dest) := nil; TObject(P).__ObjRelease; // <-- Exactly right here end; end; My call stack at that time is something as following: Lastly, my local variables are as following: I do not have anything complicated in that app. One thing which maybe relevant is that I pass some visual components (TMemo, TLabel) to a unit without form. These components are written text in them in a thread. I am using something like following to modify their values: TThread.Synchronize(nil, procedure begin BalanceLabel.Text := FormatFloat('#,##0.00', LocalBalance / 100); end); I have checked more than once to see if I am missing one visual component. I could not see any. I have googled with no luck. All my tests, debug runs returned no clue to me. Any hints to finding such FMX exceptions is appreciated. Thanks & regards, Ertan
  14. ertank

    Android - Segmentation fault (11) when closing app

    Does it also mean that I cannot be the source of the problem? I am not sure I used TFormRegistryItem t must be some visual component that I am using like TTabControl, TListView, TPanel, TLabel, TMemo, TImage etc.
  15. ertank

    Android - Segmentation fault (11) when closing app

    I could re-produce that error simply by running the app and once it is completely settled, closing it. Even for that I have spend several hours and tracked problem down to specific database operation(s). I use UniDAC and suspected that their native DBF (dBase) support might be the problem. I have remarked relevant code lines and continue my development. At some point, I needed these database operations and removed their remarks. It is very strange that after that error is not each time but random. I am not getting that error anymore, now. I do know same lines are called at each time and they are doing exact same things. If it appears again, I am going to directly check these database operations though. Thanks for the help.
  16. ertank

    Android - Segmentation fault (11) when closing app

    These are visual components placed on form. There is no code to create/free them. non visual units use them just for status update of the running thread.
  17. Hello, I am using Delphi 10.3.2. There is a project where I am communicating with another app (I will call it "other app"). Communication with other app is over clipboard. Other app is developed on Android Studio and is using some embedded device specific SDK. Other app is not a service app. It is a regular app without user interface (completely runs in the background). If that other app is not running, my app runs it. Waits until it settles completely. Starts communication. I am now asked to close that other app when my app closes. Even if I could run it using an intent, I did not find any Delphi FMX example to close it. Embedded device is running Android 5.1.1. That is unlikely to change in a near future. I believe there maybe no problem of "dangerous permissions" or similar at that Android version. Any help is appreciated. Thanks & regards, Ertan
  18. ertank

    Android - Find other app pid number and kill it

    That works nicely after adding "Kill backgound processes" permission. Thanks.
  19. In case you are taking your off-site backups on a Linux server, you might want to have a look at scp (Secure Copy). On Windows there is Putty which is free and has pscp.exe doing same job.
  20. ertank

    AES Encryption - FMX

    I failed to find a way to manually provide key and IV for AES256-CBC as byte values for that component set. However, as already indicated I use CryptoLib4Pascal successfully on VCL and FMX with help from @Ugochukwu Mmaduekwe
  21. ertank

    AES Encryption - FMX

    I could use CryptoLib4Pascal cross-platform successfully with help from @Ugochukwu Mmaduekwe My test code looks like following: uses System.NetEncoding, ClpIBufferedCipher, ClpCipherUtilities, ClpIParametersWithIV, ClpParametersWithIV, ClpParameterUtilities; procedure TForm2.Button1Click(Sender: TObject); var Cipher: IBufferedCipher; KeyParametersWithIV: IParametersWithIV; KeyBytes: TBytes; IVBytes: TBytes; Buf: TBytes; PlainText: TBytes; begin KeyBytes := [31,32,33,34,35,36,37,38,39,30,31,32,33,34,35,36,37,38,39,30,31,32,33,34,35,36,37,38,39,30,31,32]; IVBytes := [31,32,33,34,35,36,37,38,39,30,31,32,33,34,35,36]; PlainText := TEncoding.UTF8.GetBytes(Edit1.Text); Cipher := TCipherUtilities.GetCipher('AES/CBC/PKCS7PADDING'); KeyParametersWithIV := TParametersWithIV.Create(TParameterUtilities.CreateKeyParameter('AES', KeyBytes), IVBytes); Cipher.Init(True, KeyParametersWithIV); // init encryption cipher Buf := Cipher.DoFinal(PlainText); Edit2.Text := TNetEncoding.Base64.EncodeBytesToString(Buf); end; One who wants to use framework needs to put all directories & sub directories in Library Path, or use provided run-time packages. I did the former.
  22. ertank

    AES Encryption - FMX

    It is just there are internal references and functions using that type. Moreover, it includes about 65kb big commonly used unit that needs a lot more modifications than converting AnsiString that I don't want to dig into.
  23. ertank

    AES Encryption - FMX

    I heard about it. Did not give it a try yet.
  24. ertank

    AES Encryption - FMX

    I mostly use mORMot for my AES handling. Even it compiles on Linux FPC and Raspberry Pi, it doesn't compile for FMX. First compiler complaint is about AnsiString type. I tried pure Pascal Wolfgang Ehrhardt library and compiler is not happy with internal used type declarations in BType.pas file like type Str255 = string[255]; So I'm asking for help from anyone who used an AES encryption under FMX.
  25. Hello, I am using Delphi 10.3.2 and I have that project I need to use APDU commands communicating a Mifare card. I do not know java language. However, Android seems to have support for APDU commands for a very long time (like old versions such as 4.4 has that support). I have found following document: https://developer.android.com/reference/android/nfc/tech/IsoDep My problem is, I do not know APDU command use is possible with Delphi 10.3.2 on Android. I have found only one blog about RFID with Delphi FMX and that is for communicating smart tags. Unfortunately not providing help on APDU usage. http://blong.com/articles/delphixe7nfc/nfc.htm I can't find any other information about Delphi FMX and APDU. I appreciate any help. Thanks & regards, Ertan
×