Jump to content

Search the Community

Showing results for tags 'android'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 128 results

  1. Vanar

    AdMob in Delphi11

    Hi all! I'm looking for an implementation of AdMob ads under Delphi 11 on android The implementations for Delphi 10.4 and below (such as https://github.com/ersanyakit/FMX.InterstitialAd.Android, AdMobExtra...) don't work! Share if anyone has!!!
  2. Hey, i updated RAD Studio to version 12 last week. Now i wanted to update my app to work with the new android play store requirements. While testing my features i found out, that my app keeps on hanging on a black screen when i try to import a text file with a file explorer. When i manually close the app, and choose a text file and open it with my app it is working fine, but when i open the app, and then go back to my file explorer select the text file to open it again it hangs in a black screen. I tried it also with a completely new project and had the same result. I am using a Pixel 8 with Android 14. I added this intent filter to my AndroidManifest.template.xml in the activity section: <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" android:exported="true" android:label="%activityLabel%" android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode" android:launchMode="singleTask"> ... <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="text/plain" /> </intent-filter> </activity> And handle it like that: var currentIntent := MainActivity.getIntent(); HandleIntentAction(currentIntent); The handling works like a charm. When starting the app in debugging nothing happens, also logcat is showing noting in regards of my app. I also added some ShowMessages to the FormCreate functions, but also nothing. I added two logcat logs as an attachment to this post. In my opinion there is nothing wrong in the not working log. In addition to the hanging, is there a possibility to open a view directly with an intent because when i try to do a form.show it wont show up, but i haven't followed up on this issue because i wanted to resolve the black screen first. Thank you in advance! Kind regards, Dominik not_working.log working.log
  3. Hello, I'm using Rad Studio 12.1. via Android Studio, As Android14- API 34 SDK, I downloaded NDK version 20.0.5594570. I am also using jdk 22.0. I specify the paths in the SDK ndk manager by selecting the android-64 bit option from the Deployment->sdkmanager section in Rad Studio. After following these steps, when I open an empty project and run my project with Android 64 bit, it always gives the following Error: "Your Android device does not support the selected target platform architecture". As far as I understand, rad studio creates a project with arm64-v8a architecture. However, none of the Android emulator devices created with SDKManager currently support ARM architecture. It only allows emulators with x86_64 architecture. I guess that's why I'm getting this error. I've been searching for days, but I couldn't find anything clear because the versions are so new. The methods, emulator devices, etc. I use in the link below. with. I put detailed pictures about it. Can you help me
  4. bzwirs

    TAlphaColorRec in Android

    Delphi 11.2 Winsoft PDFium In app for Windows and Android I am using PDFium to create an invoice as a PDF. Included In the PDF are 2 lines of text that are colored red and one rectangle filled with color blue. Using PDFium I need to use TAlphaColorRec.Red and TAlphaColorRec.Blue to display the color on the PDF. This works fine on Windows but when compiled for Android the text colour shows as blue and the rectangle fill color is red (ie. opposite of the selected colors). Reversing the colors fixes the problem for Android but would appreciate if someone can please explain why this would happen. Thanks Bill Zwirs
  5. I don't know if this is the right place for my question since this is a General Help forum and my question is not very general but I tried also on StackOverflow (post with same title) and I get no answer, so I try here that seems to be the only forum about C++Builder. I'm writing an Android app with C++Builder 11.3 and this app should work in kiosk or immersive mode, without navigation bar, because the user must only use the app, nothing else. I searched a lot but I did not find a way to realize the kiosk mode (or the immersive mode, I think they are very similar). Someone can help me? Thanks
  6. I have a screen with the: LocationSensor: TLocationSensor; And code: procedure Tfrm.FormCreate(Sender: TObject); begin LocationSensor.Active := True; end; procedure Tfrm.FormClose(Sender: TObject; var Action: TCloseAction); begin LocationSensor.Active := False; Action := TCloseAction.caFree; end; procedure ShowLocation(); var mapPosition: TMapCoordinate; begin frm := Tfrm.Create(Application); try mapPosition := TMapCoordinate.Create(frm.LocationSensor.Sensor.Latitude, frm.LocationSensor.Sensor.Longitude); ShowMessage(FloatToStr(frm.LocationSensor.Sensor.Latitude) + ' | ' + FloatToStr(frm.LocationSensor.Sensor.Longitude)); finally frm.Show; frm.BringToFront; end; end; When I call ShowLocation(); in Android 12, it returns 'NaN | NaN' first time, after that each calling returns correct coordinates. Is it a known issue or did I miss something?
  7. I was searching around bestbuy for a streaming device that I could hook up my phone to the device and connect it to my laptop. And after searching around I saw that there are other ways to stream using OBS software on the laptop and installing an app on the phone via an ipp address. Is there a way to do this with Delphi so I don't have to worry about installing someone's app and being on *their* server? I would rather do it the Delphi way if possible, TIA.
  8. Hello, when compiling my app (the Hash FMX demo from this project: DelphiEncryptionCompendium) with Delphi 12 for Android 32 bit debug mode I get this failure message, while the same thing just works in 11.3. Compiling the FMX cipher demo for Android with 12.0 works though (I just uploaded a new aab for app store publication). Looking at the failure messages I wonder where on earth I should have gotten > 65536 methods in this project?! My 12.0 installation is a standard one with the standard SDK/NDK and Java brought by the Delphi installation. [PAClient Fehler] Fehler: E7688 ""C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot\bin\java.exe" -cp "c:\program files (x86)\embarcadero\studio\23.0\bin\Android\r8-8.0.40.jar" com.android.tools.r8.D8 --release --min-api 19 --output "D:\Projekte\DECGitMaster\Compiled\BIN_IDExx.x_Android__Demos\Hash_FMX.classes" @"D:\Projekte\DECGitMaster\Compiled\BIN_IDExx.x_Android__Demos\dex_list.txt"" kann nicht ausgeführt werden (Fehler 1) [PAClient Fehler] Fehler: E7688 Picked up JAVA_TOOL_OPTIONS: [PAClient Fehler] Fehler: E7688 Error: Cannot fit requested classes in a single dex file (# methods: 86037 > 65536). Try supplying a main-dex list [PAClient Fehler] Fehler: E7688 Compilation failed [PAClient Fehler] Fehler: E7688 Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:119) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.D8.main(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:5) [PAClient Fehler] Fehler: E7688 Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null [PAClient Fehler] Fehler: E7688 at Version.fakeStackEntry(Version_8.0.40.java:0) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:74) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:27) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.N0.b(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:2) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.D8.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.D8.b(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:13) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.D8.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:24) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:106) [PAClient Fehler] Fehler: E7688 ... 1 more [PAClient Fehler] Fehler: E7688 Caused by: com.android.tools.r8.utils.b: Cannot fit requested classes in a single dex file (# methods: 86037 > 65536) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.E2.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:21) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.E2.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.dex.t0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:228) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.dex.o0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:9) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.dex.k.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:51) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.dex.k.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:157) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.D8.d(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:152) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.D8.c(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:1) [PAClient Fehler] Fehler: E7688 at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:23) [PAClient Fehler] Fehler: E7688 ... 6 more Anybody any clue about the reason for this and how to fix it? CHeers TurboMagic
  9. My application, written for iOS, creates caf files and uploads them to the server. My other application, written for Android, would like to play these files, but cannot. Apparently different formats. Android application that creates caf files, successfully plays them The problem is not new: https://stackoverflow.com/questions/34546248/how-to-play-caf-audio-file-on-android-platform-firemonkey But 8 years have passed. I think there are solutions. I wish my Android app could play caf files from iOS.
  10. I have used Delphi 12 for developing Android application and I'm trying to Service which needs to runs in the background to receive the frequent messages from Server using TCP sockets to displays the notifications. But, the service is deactivated / closed after the main process application is closed. Below, the code is mentioned the code to start the service : procedure TForm1.ButtonServiceStartClick(Sender: TObject); var ServiceIntent: JIntent; begin ServiceIntent := TJIntent.Create; ServiceIntent.setClassName(TAndroidHelper.Context, StringToJString('com.embarcadero.services.MyService')); TAndroidHelper.Context.startService(ServiceIntent); end; and also, I have added the following service information in AndroidManifest.template.xml : <service android:enabled="true" android:exported="false" android:label="MyService" android:process=":remote" android:name="com.embarcadero.services.MyService"> </service> Code in Service: function TDM.AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags, StartId: Integer): Integer; begin Result := TJService.JavaClass.START_STICKY; end; I have tried to use this Solution, but not able to compile. And tried to implement the Sleep in Android Start command / run the thread, still the android service is getting closed. Do, I need to mentioned the different flag for starting the service or do I need to add additional code to run the service all the time or can we restart the service once it's destroyed and how to handle the code in Destroy event?
  11. Have recompiled an app for Android with Delphi 11.3 and now get the following error when entering numbers into a dbdatagrid (Firepower) and tmsfnc edit control (in both cases have keyboard set to numberpad): Eval Error in: java.lang.indexoutofboundsexception setspan(3...3) ends beyond length 1. The error only occurs on Android tablet - not on Windows version. Have never seen this error before under previous versions of Delphi. Can someone please shed some light on this problem and point me in the right direction to fix it. Bill
  12. Using Delphi 12, Woll2Woll Firepower Data Grid, Firedac Query, SQLite DB Have an app that has been used for couple of years without any significant issues until recent compile with Delphi 12. The issue is with editing an integer field in a Firepower data grid. For the field keyboard type I have selected the numberpad type. Previously users have always been able to select the minus sign to input a negative number but this no longer works since the last compile for Android. Can anybody please help with advice on how to fix this issue. Bill Zwirs
  13. Hi, I take many photos with my Android phone. And now I need a way to Add some search text to the image so that I can find the photos. With a custom image viewer app I will create in conjunction with the metadata reader/writer, my search method would be to open the phone's Gallary (I don't know how to do this yet) and then enter a search word and only photos that match will show, like the way they do when you are in the Gallary app. I searched around and see references for ccr-exif but it is for Delphi VCL, not FMX/Android. Is there a Delphi unit that provides this or someplace where I can download a working project to accomplish this ? TIA.
  14. HI there i just made a try, i started there! To work on the Android platform using compile directives, i needed to make some modifications to the code in several files. Lets focus on 'svn.overbyte.be/svn/icsv9/Source/OverbyteIcsUtils.pas'.The classTIcsIntegerList is essentially a wrapper around the TList class, since this code was designed for use in a Windows platform target, on a different platform, i needed to make some adjustments. type TIcsIntegerList = class(TObject) private FList : TList<Integer>; // Use TList<Integer> instead of TList function GetCount: Integer; function GetFirst: Integer; function GetLast: Integer; function GetItem(Index: Integer): Integer; procedure SetItem(Index: Integer; const Value: Integer); public constructor Create; virtual; destructor Destroy; override; function IndexOf(Item: Integer): Integer; function Add(Item: Integer): Integer; virtual; procedure Assign(Source: TIcsIntegerList); virtual; procedure Clear; virtual; procedure Delete(Index: Integer); virtual; property Count: Integer read GetCount; property First: Integer read GetFirst; property Last : Integer read GetLast; property Items[Index: Integer] : Integer read GetItem write SetItem; default; end; // ... other codes { TIcsIntegerList } function TIcsIntegerList.Add(Item: Integer): Integer; begin Result := FList.Add(Item); // No need to typecast Item to Pointer end; procedure TIcsIntegerList.Clear; begin FList.Clear; end; constructor TIcsIntegerList.Create; begin FList := TList<Integer>.Create; // Use TList<Integer> instead of TList end; procedure TIcsIntegerList.Delete(Index: Integer); begin FList.Delete(Index); end; destructor TIcsIntegerList.Destroy; begin FList.Free; inherited; end; function TIcsIntegerList.GetCount: Integer; begin Result := FList.Count; end; function TIcsIntegerList.GetFirst: Integer; begin Result := FList.First; // No need to typecast FList.First to Integer end; function TIcsIntegerList.GetLast: Integer; begin Result := FList.Last; // No need to typecast FList.Last to Integer end; // ... other codes but i faced a lot of errors when i target android platform and compiled, it gives me errors like: [DCC Error] OverbyteIcsUtils.pas(5931): E2023 Function needs result type [DCC Error] OverbyteIcsUtils.pas(5933): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5933): E2003 Undeclared identifier: 'Item' [DCC Error] OverbyteIcsUtils.pas(5938): E2004 Identifier redeclared: 'TIcsIntegerList' [DCC Error] OverbyteIcsUtils.pas(5940): E2003 Undeclared identifier: 'FList' [DCC Error] OverbyteIcsUtils.pas(5945): E2037 Declaration of 'TIcsIntegerList' differs from previous declaration ...: So how to fix it? Or can anyone point me to the right direction?
  15. Hi there, I've got suspicious log messages, with an Android App under Rx11.3. I am not using any 3rd Party frameworks, nor can I imagine what could cause this warning. When I check, these fieds seems to be deprecated since Android 10, related to accessing screen contents. https://developer.android.com/about/versions/10/privacy/changes#screen-contents In the sources under FMX.Platform.Screen.Android, there seems to be a possible relation to DisplayManager, maybe this is doing something with the display. https://developer.android.com/reference/kotlin/android/hardware/display/DisplayManager#virtual_display_flag_auto_mirror https://developer.android.com/reference/kotlin/android/hardware/display/DisplayManager#virtual_display_flag_secure or maybe RestrictedScreenReading has to do with it ... https://source.android.com/docs/core/permissions/restricted-screen-reading?hl=en FMX.Platform.Screen.Android: TAndroidScreenServices = class(TInterfacedObject, IFMXMultiDisplayService, IFMXScreenService, IFMXDeviceMetricsService, IFMXFullScreenWindowService) ... public property DisplayManager: JDisplayManager read FDisplayManager; property IsPrimaryDisplayDefined: Boolean read FIsPrimaryDisplayDefined; property PrimaryDisplay: TDisplay read FPrimaryDisplay; end; But that is a rough guess. The app seems to behave normally, but I wonder if that might cause probems in the future. I'm testing under Android 14 now. If anyone knows how to get rid of these warnings, or at least a hint where this could be related to, please let me know.
  16. I'm writing a FMX app (lets call it appD) for Android in Delphi 11.3 that has to be called/started - and receive some data - from an Android app (let's call it appF) developed by another team (they use Flutter). AppF uses an intent like this for calling my app: AndroidIntent( action: "android.intent.action.launch.from.appF", package: "com.test.appd", arguments: { "userId": "User01”, "token": "SomeToken" }, flags: [0123456], ) My app, appD, starts when called by tappF, but I'm unable to receive the data I need (userID, token and flags). I have made some experiments with the following code from the sample project ReceiveIntent.dproj, but without success: function TForm1.HandleIntentAction(const Data: JIntent): Boolean; var Extras: JBundle; jsonMsg: string; begin Result := False; if Data <> nil then begin Memo1.ClearContent; Extras := Data.getExtras; if Extras <> nil then begin jsonMsg := JStringToString(Extras.getString(TJIntent.JavaClass.EXTRA_TEXT)); Memo1.Text := jsonMsg; end; Invalidate; end; end; This function is called and I get no errors, but jsonMsg is always empty. I'm a noob as per Android development... can someone show me the right way to retrieve the arguments passed by the appF? I'm really lost... Thanks for your time!
  17. Hi there, I wanted to create an new keystore file, still under RadStudio 11.3, which works. But I haven't used that quite some time, and I must find out that the "Alias Password" is no more available or possible to set. In the dialog, there is still the option, but that seems not really get activated and longer. The first step looks quite normal but the 2nd step, never shows the Alias password It is possible to create a keystore still but of course without the alias password, also here The Alias Info looks OK, but missing password Commandline After some evaluation on commandline, it seems that the former keytool parameters seems to be changed. 1.) From something before, with -genkey keytool -genkey -v -keystore %ks_file% -alias %ks_alias% -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -validity 9132 2.) to something new, with -genkeypair keytool -genkeypair -v -keypass "%ks_pass%" -keystore %ks_file% -alias %ks_alias% -keyalg RSA -keysize 2048 -validity 9132 This works quite similar and looks like the proper replacement, unfortunately I cannot find since when this might have changed. I am working on the pre-installed JDK from the D11.3 IDE, which should be untouched and OK: Possible changes, with maybe sideeffects in the PlayStore, GCM or elsewhere: 1.) old method : This used the -sigalg SHA1withRSA, while 2,) new method: This used the -sigalg SHA256withRSA Yes, that make perfectly sense, since SHA1 is quite banned everywhere. Though, my questions are still: - Is this change officially documented anywhere? (probably not really for Delphi, but for Android, GCM or Firebase would be great) for example https://stackoverflow.com/questions/65920211/warning-sha1-algorithm-and-sha1withrsa-algorithm-specified-will-be-disabled-in https://www.ibm.com/docs/en/semeru-runtime-ce-z/17?topic=jcecca-sha1withrsa https://stackoverflow.com/questions/70419377/how-to-update-the-android-keystore-signature-algorithm-name-sha1withrsa-weak https://github.com/italia/cie-ideaapp/issues/4 But not much really related directly to Android Apps, PlayStore and Google Cloud Services. - Are there any further known requirements, or known sideeffects, for that alias password or SHA1withRSA algorithm? ( I can remember darkly, that I have read about such requirement somewhere, some years ago, but probably those procedures have changed meanwhile ). - What would be the right way to create Keystore in 2023 then, the usual IDE way, without alias password, or probably using a commandline option, either similar or different as 2.) ? I assume that the new D12.0 might also clarify about that process, but I still have to use my beloved D11.3 for a short while 🙂
  18. Hi! Android app. seems working fine in debug or release (Development) mode on my Android device. But if I upload the AAB file to Google Play Store and install it from there it exits on startup. Not sure if it's a crash I have very little experience with Android. The project is from the XE5 era. Tried: - Deleted the manifest file, so it was re-created by Delphi - Did a "Revert system files to default" - Did a "Revert to default" in Deployment Google Play Store page: https://play.google.com/store/apps/details?id=com.embarcadero.MP4StreamEditorClient As I wrote it seems working fine if I start it through Delphi+USB and also if I start it after it has been installed by Delphi, just the Install and start from Play Store does not work. Any ideas? Thank you! 3delite
  19. SPECS: Delphi 11.2, Galaxy S10+ phone (Android 12) (screen size is 6.4 inches) Issue: I want to change the view in the IDE to match my phone but the closest one is the 'Android 5" phone', and when I add componets on the form in that view, after compiling, the controls don't fit the screen and/or are sometimes off the view of the screen. In Delphi XE7, in the View's drop-down list, there is a custom setting option. I think I only used it once for a tablet years ago, but could not figure it all out and gave up. However, in 11.2, there is no listing for custom. So, I was wondering if there are downloadable views, or does the developer has to figure it out manually by eye/try. I've been searching around but cannot find any answers. TIA.
  20. specs: window 7 64bit, delphi 11.2, phone s10+ with android 12 I've been wanting to ask this question for some time and an opportunity came to me and I'm now asking... I would like to send text from my galaxy s10+ phone to my laptop over wifi, and back, from my laptop to Android over wifi. I want to type some text, a word, or a whole paragraph, and send it. Are there any demos or how-tos for this? I searched my sample folders but did not find anything. Also, I do not want to use a USB cable, nor do I want to join/use any outside services from other sources. I don't want to download any apps, register, and all that. I want this to be strictly private and only from my two devices. TIA
  21. Hi there, recently I've got some insights, about the internal TBitmap magic in FMX, for the following code snippet, under Android: procedure TTestForm.SaveImageToTemporaryStore( const AImage : TBitmap; const AArrayList : JArrayList; const AIndex : Integer ); var LImageFile : JFile; LImageUri : Jnet_Uri; LOutputDir : JFile; LPath : String; begin // Retrieves the apps cache, temporary file storage folder LOutputDir := TAndroidHelper.Context.getExternalCacheDir(); // Creates a temporary file in that cache folder LImageFile := TJFile.JavaClass.createTempFile( StringToJString( 'attachment' + AIndex.ToString ), StringToJString( '.png' ), //<== This is the only palce where png comes into play LOutputDir ); // Get that file as URI LImageUri := TAndroidHelper.JFileToJURI( LImageFile ); // Retrieve that path, for testing purposes, it looks like this: // '/storage/emulated/0/Android/data/com.embarcadero.APPNAMEHERE/cache/attachment05833119307942135994.png' LPath := JStringToString( LImageFile.getAbsolutePath ); // Save the TBitmap to that IRI file Path, works pretty well AImage.SaveToFile( LPath ); That works well and all as expected. When I send that file via sharesheet then after, also that works fine. // If we use ACTION_SEND_MULTIPLE action of Intent, we should put image throught Parcelable Array List. // Because in this case other application read EXTRA_STREAM like a ArrayList<Uri> // Created externally by LArrayList := TJArrayList.Create; AArrayList.add( LImageUri ); end; Then finally this is added to an Intent, to share to other apps. That works well, put it as below into the Intent as EXTRA_STREAM, it sends the .png file via different apps: LIntent.putParcelableArrayListExtra( TJIntent.JavaClass.EXTRA_STREAM, LArrayList ); So all works well and I should not complain. But it struck my, when I asked myself: Why does the source TBitmap converts to a *.png file in the first place ? Why didn't I had to fumble around with TBitmapCodecManager or something else, to get this conversion coded ? After some investigation, looking into the TBitmap.SaveToFile( LPath ); I found that the trick, by hidden conversion, depending on the file extension: procedure TBitmap.SaveToFile(const AFileName: string; const SaveParams: PBitmapCodecSaveParams = nil); var Surf: TBitmapSurface; begin TMonitor.Enter(Self); try Surf := TBitmapSurface.Create; try Surf.Assign(Self); if not TBitmapCodecManager.SaveToFile(AFileName, Surf, SaveParams) then raise EBitmapSavingFailed.CreateFMT(SBitmapSavingFailedNamed, [AFileName]); finally Surf.Free; end; finally TMonitor.Exit(Self); end; end; Sometimes, I'm still surprised by the hidden convenience that Firemonkey provides for us. Under VCL I would have to convert this image the hard way by myself, for example with TPNGImage, like PeterBelow pointer out here. I'm always happy when FMX made me forget such nasty details
  22. We've been having a strange issue using the TRESTRequest component with some of our users. When we call the request.execute on those devices, it always raises an exception with the message of "External Exception 0". Weirdly it only seems to happen on Samsung devices, particularly newer models such as the S22 Ultra (but not exclusively that device). It happens for every API call we make, but only affects our app. The user reports that all their other apps can talk to the internet fine, so not sure what this could be. We have a number of newer Samsung test devices but can't reproduce this issue. The error seems to be coming from the OS rather than Delphi, but I can't see any reason for it. We've been exploring device config-specific factors such as firewall apps, disabling data access to the app etc but there doesn't seem to be anything special. Most affected users keep their devices as factory default for these settings. I've extract a logcat from those devices (I don't have physical access to the device though), and it doesn't show any errors, warnings or messages related to network access, security or things I would expect if the OS was the cause. We're running out of ideas, and the users are becoming frustrated as they can't use the cloud features of our app. I'd really appreciate any thoughts, suggestions or even just troubleshooting theories that could help to figure this out. Thanks!
  23. helste7023

    App for Android 11 with Delphi 10.1

    Hello, I still am on Delphi 10.1, because it does all what need and I hat spending 2 days installing all my third party components after upgrading to a new Delphi version. And of course it is not that cheap any more as it used to be, when I started with Delphi a long time ago. Unfortunately an Android app I made with Delphi 10.1. does not start on a new device with Android 11. Is there a way to get an app, that is made with Delphi 10.1 working on Android 11 or do I have to upgrade to Delphi 11.x? Any help would be highly appreciated.
  24. hackbrew

    App persistence and restoring state

    Currently, I'm working on an Android 13 FireMonkey mobile app (Delphi 11.3) with a TabControl with about four tabs. The app is grabbing JSON data from a URL and manually parses and loads the data into a FDMemTable. The app has very small data requirements (ie., single user, single table, and the JSON file would exchange only about 25 records per day containing about a dozen or so key/value pairs). Besides the memory table, I'm using an embedded database (SQLite) to store the data on device using LocalSQL features to implement database CRUD operations. My concern is persistence and restoring state if the app were to say crash/lose focus/device reset. Right now each time the app gains focus it starts from the beginning. For example, when running the app and then a call comes in on the device, my app loses its focus. When you return back to the app it starts as in the first time. I would like it if when the app restarts to remain in the same state it was before going to the background. I played around with the OnSaveState event on my main form, but it didn't behave the way I expected. For example, I send a mapping intent from my app to the default mapping app on the device for navigation. In this instance, the user temporarily leaves my app when the mapping app opens, and when closed, the user should return to my app. When I implement the OnSaveState event into my app (to read/write data to a stream) the user never returns to my app after closing the mapping app. But, if I remove the OnSaveState event, it does return back to my app, which is the desired behavior. How should persistence and restoring state be handled in an Android app?
  25. i have this code here: fTask: ITask; fTask := TTask.Create( procedure begin while not True do Application.ProcessMessages; TThread.Synchronize(TThread.Current, procedure begin // update ui end); end); fTask.ExecuteWork; // this will stop here.. until [fTask] finish work !! In android didn't wait untill Task Complete !!
×