Search the Community
Showing results for tags 'android'.
Found 149 results
-
Hi All! Does anyone have a Goolge account login implementation for Delphi 11? Examples like GoogleSignin tweaked for Delphi <11 don't work!
-
- delphi 11
- google signin
-
(and 2 more)
Tagged with:
-
Hi, i have a multi platform app that i'm maintaining from a few time I'm getting used to debug problems, but when the app is stuck into the splashscreen and Delphi cannot even start the debug mode the problem begins. I used logcat but cannot really get any useful information. The last time i had this problem it was caused from some .so files in a wrong path and the code put into the initialization section to load those .so files was crashing my app. But this time i already fixed that and i already tried to comment out all the code into the initialization section. What can i try to understand why my app is stuck? Ide shows no errors, and this is my logcat The only error shown is "isHeavy hint type 1 for app" but i have no variable called isHeavy in my code so i really have no idea what is referring to 12-16 09:39:47.578: D/Launcher.CellLayout(3938): touch item:ShortcutInfo, id=99, itemType=0, user=UserHandle{0}, mIconType=0, pkgName=<my package name>, className=com.embarcadero.firemonkey.FMXNativeActivity, screenId=2, container=-100, cellX=3, cellY=3, spanX=1, spanY=1, isLandscapePos=false 12-16 09:39:47.598: D/Launcher_dispatchTouchEvent_View(3938): 39:47.597 View= mHCells=4 mVCells=6 mTotalCells=24 mCellXY[0]=3 mCellXY[1]=5 childCount=16 EmptyCellsNum=8 [ tag 0 =com.miui.home.launcher.FolderIcon{f02e59 VFE...CL. ........ 795,84-1049,383}| childWidth 0 =254| childHeight 0 =299| childTranslationX 0 =0.0| childTranslationY 0 =0.0| childX 0 =795.0| childY 0 =84.0| childAlpha 0 =1.0] [ tag 1 =com.miui.home.launcher.ShortcutIcon{cb4f70e VFE...CL. ........ 33,84-287,383}(Impostazioni)| childWidth 1 =254| childHeight 1 =299| childTranslationX 1 =0.0| childTranslationY 1 =0.0| childX 1 =33.0| childY 1 =84.0| childAlpha 1 =1.0] [ tag 2 =com.miui.home.launcher.ShortcutIcon{85f4ea3 VFE...CL. ........ 33,389-287,688}(Note)| childWidth 2 =254| childHeight 2 =299| childTranslationX 2 =0.0| childTranslationY 2 =0.0| childX 2 =33.0| childY 2 =389.0| childAlpha 2 =1.0] [ tag 3 =com.miui.home.launcher.ShortcutIcon{a32dacd VFE...CL. ........ 287,84-541,383}(Mi Video)| childWidth 3 =254| childHeight 3 =299| childTranslationX 3 =0.0| childTranslationY 3 =0.0| childX 3 =287.0| childY 3 =84.0| childAlpha 3 =1.0] [ tag 4 =com.miui.home.launcher.ShortcutIcon{579b6e7 VFE...CL. ........ 541,84-795,383}(Meteo)| childWidth 4 =254| childHeight 4 =299| childTranslationX 4 =0.0| childTranslationY 4 =0.0| childX 4 =541.0| childY 4 =84.0| childAlpha 4 =1.0] [ tag 5 =com.miui.home.launcher.ShortcutIcon{603d248 VFE...CL. ........ 33,694-287,993}(AnyDesk)| childWidth 5 =254| childHeight 5 =299| childTranslationX 5 =0.0| childTranslationY 5 =0.0| childX 5 =33.0| childY 5 =694.0| childAlpha 5 =1.0] [ tag 6 =com.miui.home.launcher.ShortcutIcon{8e5aedb VFE...CL. ........ 541,389-795,688}(Mi Browser)| childWidth 6 =254| childHeight 6 =299| childTranslationX 6 =0.0| childTranslationY 6 =0.0| childX 6 =541.0| childY 6 =389.0| childAlpha 6 =1.0] [ tag 7 =com.miui.home.launcher.ShortcutIcon{d6128bc VFE...CL. ........ 541,694-795,993}(Pilot)| childWidth 7 =254| childHeight 7 =299| childTranslationX 7 =0.0| childTranslationY 7 =0.0| childX 7 =541.0| childY 7 =694.0| childAlpha 7 =1.0] [ tag 8 =com.miui.home.launcher.ShortcutIcon{d3e54b5 VFE...CL. ........ 287,389-541,688}(Assistente)| childWidth 8 =254| childHeight 8 =299| childTranslationX 8 =0.0| childTranslationY 8 =0.0| childX 8 =287.0| childY 8 =389.0| childAlpha 8 =1.0] [ tag 9 =com.miui.home.launcher.ShortcutIcon{b8369ee VFE...CL. ........ 287,694-541,993}(Iotar)| childWidth 9 =254| childHeight 9 =299| childTranslationX 9 =0.0| childTranslationY 9 =0.0| childX 9 =287.0| childY 9 =694.0| childAlpha 9 =1.0] [ tag 10 =com.miui.home.launcher.ShortcutIcon{6bed613 VFE...CL. ........ 795,389-1049,688}(NordVPN)| childWidth 10 =254| childHeight 10 =299| childTranslationX 10 =0.0| childTranslationY 10 =0.0| childX 10 =795.0| childY 10 =389.0| childAlpha 10 =1.0] [ tag 11 =com.miui.home.launcher.ShortcutIcon{30d4ffe VFE...CL. ........ 541,999-795,1298}(<my app name> Mobile Assist)| childWidth 11 =254| childHeight 11 =299| childTranslationX 11 =0.0| childTranslationY 11 =0.0| childX 11 =541.0| childY 11 =999.0| childAlpha 11 =1.0] [ tag 12 =com.miui.home.launcher.ShortcutIcon{d4fa929 VFE...CL. ........ 33,999-287,1298}(AIDA64)| childWidth 12 =254| childHeight 12 =299| childTranslationX 12 =0.0| childTranslationY 12 =0.0| childX 12 =33.0| childY 12 =999.0| childAlpha 12 =1.0] [ tag 13 =com.miui.home.launcher.ShortcutIcon{194fa12 VFE...CL. ........ 287,999-541,1298}(QuickSupport)| childWidth 13 =254| childHeight 13 =299| childTranslationX 13 =0.0| childTranslationY 13 =0.0| childX 13 =287.0| childY 13 =999.0| childAlpha 13 =1.0] [ tag 14 =com.miui.home.launcher.ShortcutIcon{bd39537 VFE...CL. ........ 795,694-1049,993}(App Info)| childWidth 14 =254| childHeight 14 =299| childTranslationX 14 =0.0| childTranslationY 14 =0.0| childX 14 =795.0| childY 14 =694.0| childAlpha 14 =1.0] [ tag 15 =com.miui.home.launcher.ShortcutIcon{6d564e6 VFE...CL. ...P.... 795,999-1049,1298}(<my app name>)| childWidth 15 =254| childHeight 15 =299| childTranslationX 15 =0.0| childTr 12-16 09:39:47.598: D/Launcher_dispatchTouchEvent_View(3938): 39:47.597 View=com.miui.home.launcher.ShortcutIcon{6d564e6 VFE...CL. ...P.... 795,999-1049,1298}(<my app name>) 12-16 09:39:47.666: I/ActivityTaskManager(1757): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=<my package name>/com.embarcadero.firemonkey.FMXNativeActivity bnds=[840,1098][1008,1266] (has extras)} from uid 10078 12-16 09:39:47.670: E/ANDR-PERF-LM(988): GAMEOPT: getData() 1035: isHeavy hint type 1 for app <my package name> 12-16 09:39:47.678: V/ActivityTaskManager(1757): Starting new activity ActivityRecord{f754cfb u0 <my package name>/com.embarcadero.firemonkey.FMXNativeActivity t140} in new task Task{304e060 #140 visible=true type=standard mode=fullscreen translucent=true A=10291:<my package name> U=0 StackId=140 sz=1} 12-16 09:39:47.732: D/Boost(1757): hostingType=pre-top-activity, hostingName={<my package name>/com.embarcadero.firemonkey.FMXNativeActivity}, callerPackage=com.miui.home, isSystem=true, isBoostNeeded=false. 12-16 09:39:47.733: I/ActivityManager(1757): Start proc 28622:<my package name>/u0a291 for pre-top-activity {<my package name>/com.embarcadero.firemonkey.FMXNativeActivity} caller=com.miui.home 12-16 09:39:47.742: V/WindowManager(1757): Orientation start waiting for draw, mDrawState=DRAW_PENDING in Window{13c228d mode=0 rootTaskId=140 u0 Splash Screen <my package name>}, surfaceController Surface(name=Splash Screen <my package name>)/@0xa3ec6bc 12-16 09:39:47.794: I/GST(6103): forePkg: <my package name>, preForePkg: com.miui.home 12-16 09:39:47.794: D/PerfEngineController(6093): ForegroundInfo{mForegroundPackageName='<my package name>', mForegroundUid=10291, mForegroundPid=28622, mLastForegroundPackageName='com.miui.home', mLastForegroundUid=10078, mLastForegroundPid=3938, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=1} 12-16 09:39:47.795: I/ProcessMonitor(5408): onForegroundInfoChanged: ForegroundInfo{mForegroundPackageName='<my package name>', mForegroundUid=10291, mForegroundPid=28622, mLastForegroundPackageName='com.miui.home', mLastForegroundUid=10078, mLastForegroundPid=3938, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=1} 12-16 09:39:47.795: D/AutoInstallService(11010): onForegroundInfoChanged: <my package name> 12-16 09:39:47.795: I/GameBoosterService(5408): onForegroundInfoChanged: Cur=<my package name> last=com.miui.home 12-16 09:39:47.801: D/GameBoosterService(5408): onGameStatusChange foreground:ForegroundInfo{mForegroundPackageName='<my package name>', mForegroundUid=10291, mForegroundPid=28622, mLastForegroundPackageName='com.miui.home', mLastForegroundUid=10078, mLastForegroundPid=3938, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=1} 12-16 09:39:47.881: D/View(28622): <my package name> initForcedUseForceDark: 1 12-16 09:39:47.909: W/linker(28622): Warning: "/data/app/~~wyLwJiilp-W6tb-ch2CPmA==/<my package name>-jZXsqAEEsEtrsmvpmPdF4Q==/lib/arm64/lib<my app name>.so" unused DT entry: DT_RPATH (type 0xf arg 0x2f4c4) (ignoring) 12-16 09:39:48.405: I/ActivityManager(1757): Process <my package name> (pid 28622) has died: fg TOP 12-16 09:39:48.550: W/WindowManager(1757): Failed to schedule DisplayAdjustmentsItem to ProcessRecord{d1d4bbf 28622:<my package name>/u0a291} 12-16 09:39:48.555: D/CommandQueue(3690): setStatus: setStatus: what = 0, action = upate_specail_mode, ext = Bundle[mParcelledData.dataSize=112][pkg = <my package name>[enable_config = false 12-16 09:39:48.657: D/Boost(1757): hostingType=top-activity, hostingName={<my package name>/com.embarcadero.firemonkey.FMXNativeActivity}, callerPackage=com.miui.home, isSystem=true, isBoostNeeded=false. 12-16 09:39:48.657: I/ActivityManager(1757): Start proc 28653:<my package name>/u0a291 for top-activity {<my package name>/com.embarcadero.firemonkey.FMXNativeActivity} caller=com.miui.home 12-16 09:39:48.805: D/View(28653): <my package name> initForcedUseForceDark: 1 12-16 09:39:48.829: W/linker(28653): Warning: "/data/app/~~wyLwJiilp-W6tb-ch2CPmA==/<my package name>-jZXsqAEEsEtrsmvpmPdF4Q==/lib/arm64/lib<my app name>.so" unused DT entry: DT_RPATH (type 0xf arg 0x2f4c4) (ignoring) 12-16 09:39:49.325: I/ActivityManager(1757): Process <my package name> (pid 28653) has died: fg TOP 12-16 09:39:49.356: D/Boost(1757): hostingType=top-activity, hostingName={<my package name>/com.embarcadero.firemonkey.FMXNativeActivity}, callerPackage=com.miui.home, isSystem=true, isBoostNeeded=false. 12-16 09:39:49.356: I/ActivityManager(1757): Start proc 28696:<my package name>/u0a291 for top-activity {<my package name>/com.embarcadero.firemonkey.FMXNativeActivity} caller=com.miui.home 12-16 09:39:49.473: D/View(28696): <my package name> initForcedUseForceDark: 1
-
- firemonkey
- fmx
-
(and 3 more)
Tagged with:
-
I have two different, very simple, cross-platform projects I'm using for development testing, one works fine, the other used to but is now getting a strange error when I try to deploy it to my Android device: The project that deploys fine has the same base project filename as the folder in which it resides. The second project (the one with the problem), DelphiVersions, is one of several projects in a folder, each project's name is appended with the type of platform it's for. The folder name is V:\DelphiVersions and I have DelphiVersionsConsole, DelphiVersionsVCL, and DelphiVersionsMobile in that folder. The last one, of course, uses FireMonkey, and is deployed to Android and iOS. I'm using Delphi 10.4 and had this working a few months ago but since Android 11 and API 30 was released I wanted to have more direct control over where and which SDK was installed and found this excellent blog that helped me get there. This also meant I switched to using OpenJDK and changed the location of the SDK and tools. Should still be good, right? As I examined the project trying to figure this out, I deleted temporary files, even removed Android support from the project and re-added it, and checked a few other things. The only thing I can think of that is different where deployment is concerned, is that the DelphiVersions one has "Mobile" appended to the end of the project name and one of the build tools must assume the project name is the same as the folder name. The obvious thing to try is rename the project to just DelphiVersions to match the folder name--I did that but it gave a similar error, this time with the path "V:\DelphiVersions\bin\DelphiVersions.apk" not found. So mismatched project name is not the source of the problem. Another thing to note is that I have projects for several versions of Delphi in sub folders and for Delphi 10.4 it's in a "104Sydney" folder and it actually generates "V:\DelphiVersions\104Sydney\DelphiVersionsMobile\bin\DelphiVersionsMobile.apk" (the file is actually where it should be!). I also looked at the deployment file list and the manifest file--still no clue. Why is the deployment process removing the first two sub-levels of folders in the filename?
-
Hello, I am using Delphi 10.4.2. There is a very simple app (needs internet and network status permissions, 3 pages total) that I need to run on Android 5.0.2. I compiled it with stock SDK 25.2.5 targeting Android32. When package tried to be loaded on Android 5.0.2 it says Compiler error There is a problem with the packet parsing. Docwiki says Delphi 10.4.2 supports Android 6 minimum. Even Delphi 10.3.3 supports Android 5.2 mimimum. I wonder if there is some "workaround" that I can use without installing an older version. Thanks & Regards, Ertan
-
It can be stupid but I decided to ask. In an android application just a Delphi form and its dependencies add 30MB in the file .so of the application. Is it possible to have it as an external library and being loaded when needed? Is that possible in android and how can be done? Thank you in advance
-
Hi, I want to create a Notification in an android application that shows the progress in uploading an image. I have seen many styled, multiline with icons notifications in existing applications, having also controls like a progress bar. Tried to do the same in Delphi, and I have not managed to find documentation, nor an example how to do that, without writing it in java. I found that even Flutter can now show a notification with controls inside. Can Delphi show such a notification and update its contents? Thank you in advance
-
Delphi 10.4.2 Latest Android update has killed using S pen on edit field to bring up the virtual keyboard. Using finger or other type stylus is Ok. S pen does bring up the keyboard on other apps but not on the app compiled by Delphi. Have tried different settings on the tablet (Tab 6 Lite) but to no avail. Has anybody had the same problem and is this an Android thing or do I need to add something to my program code? Any advice would be greatly appreciated. Bill Zwirs
-
Hello, Is there a solution with FMX to have an events listener that detects all the events that are triggered in an app? Thanks for all
-
Hi, I am looking for Delphi examples on waking up an application when an Android device is in sleep mode. Setting an alarm with the AlarmManager TAndroidHelper.AlarmManager.&set(TJAlarmManager.JavaClass.RTC_WAKEUP,...) fires MyAppEvent on time, it writes a message in the Memo, but the app does NOT wake up. function TfrMain.MyAppEvent(aAppEvent: TApplicationEvent; AContext: TObject): Boolean; begin result := False; case aAppEvent of TApplicationEvent.BecameActive: memo1.Lines.Add('BecameActive'); ... Only when I manually wake up the device, I see the app appear on screen. How can wake up the device when MyAppEvent notifies the event of becoming active? Even more, the app should become on the front of other running applications in the case the device is not asleep. I've searched already on the possibilities of the AlarmManager and the PowerManager, but found nothing to wake up while being asleep. Any example would be appreciated!
-
Delphi 10.4.2 Have used sample code provided by to send email with attachment from Android app and works fine. After I actually send email and have been returned to app I click a button to return me to the app's main menu screen (tab control) with this code TabControl1.SetActiveTabWithTransition(TabItem1,TTabTransition.Slide,TTabTransitionDirection.Reversed); but instead of returning back to main menu screen the current screen scrolls upwards and have to click button again to return to main menu screen. After this every tab control screen behaves the same way and this only happens after the send email with attachment is used. I am using the sample code from Delphi Scrollable Form Demo provided by Delphi and believe this has something to do with my problem but don't understand how. Can someone please help me with this. Thanks in advance Bill
-
Delphi 10.4.2 Have debug parameter set to -cleaninstall in project options yet when I install to an Android device the database file (assets/internal) is not being replaced on the device. Actually, was initially but suddenly not anymore. Can anybody PLEASE point me in the right direction to solve this. Any help would be greatly appreciated Bill
-
Delphi 10.4.2 I want to use assets/external when deploying a database file to an Android device. The device doesn't actually have any external storage (sd card) so the installation auto creates a ./external directory in the internal app directory. What is the correct way to set the database path. Documentation says to use 'TPath.Combine(TPath.GetSharedDocumentsPath,'database.db') when using assets/external yet when I use this the app cannot find the database file. Can someone please advise me as to where I am going wrong with this. Thanks in advance Bill
-
10.4.2: Android Projectoptions/Version/VersionCode problem
microtronx posted a topic in Cross-platform
It is a small bug but it annoys us every day: https://quality.embarcadero.com/browse/RSP-25667?jql=text ~ "versioncode" Please vote for it so it gets solved!-
- android
- projectoptions
-
(and 2 more)
Tagged with:
-
Delphi 10.4.2 Have developed a custom app for use on Android tablet for a business. There will be approx 10 users of this app. The plan is to notify users of any update through Google Drive allowing the user to receive a link and update there tablet with latest version of the app. Especially in the early stages this may mean an updated database file (SQLite) in which case -cleaninstall is used. On testing this, if I copy .apk file direct to tablet's download directory and then navigate to that directory and double click to install......all works and db file is replaced. When testing this using Goole drive (same apk file) the app is updated but the db file is not replaced. Should I be doing something else other than '-cleaninstall' Any advice would be appreciated. Bill Zwirs
-
TBluetoothGattCharacteristic.SetValueAs will not reduce the size of the value array.
jcwhit posted a topic in FMX
This issue shows up when writing a Characteristic from the Andorid app to the BT device. Here is the sequence using these TBluetoothGattCharactertistics methods SetValueAsUint32, then 4 bytes are transmitted. SetValueAsUint64, then 8 bytes are transmitted SetValueAsUint32, then 8 bytes are transmitted, the first four bytes contain the new 32 bits and the remaining 4 bytes contain the previous 64 bit value ************************************************************************************************************* In System.Bluetooth we find this method @line 2717(10.4.2), which all of the above methods call procedure TBluetoothGattCharacteristic.SetValueAs<T>(AValue: T; Offset: Integer); var LBytes: TBytes; begin LBytes := Value; if (Length(LBytes) < Offset + SizeOf(AValue)) then SetLength(LBytes, Offset + SizeOf(AValue)); Move(AValue, LBytes[Offset], SizeOf(AValue)); SetValue(LBytes); end; LBytes is always the last value sent (64 bits or 8bytes in the above example). As long as offset is zero (0), following a 64bit value with a 32bit or less value, will always result in SetLength not being called. And as long as offset is zero, this procedure can never reduce the size of LBytes, it can only increase the size of LBytes. ***************************************************************************************************************** my work around was to create a method in my BT wrapper that creates a variable ClrValue of type TBytes set length to 1 call the method SetValue(ClrValue) This resets the TBluetoothGattCharactertistics property Value to be length 1 and thus the SetLength in the above code will always be called and the correct number of bytes will be transmitted. ***************************************************************************************************************** I went back and checked 10.1 Update2 and the same code as above is there. This may be expected behavior, I dont know, Other than my little work around, I found no intrinsic way to change the array length and thus the bytes transmitted. If you call SetValueAsUint32, I would expect 4 bytes to be transmitted, regardless of what was transmitted before. -
My App work perfect in Android but show access violation error!
Leo Lui posted a topic in Cross-platform
My app pop up "Access violation at address 000000001BB022128, accessing address 000030312E353820" error in iPhone. Android works perfectly without this error. This error pops up when 1. Run the app 2. Press the home button (my app still running in background) 3. Run other apps 4. Go back to my app 5. Error popup. It is quite strange that my development device iPhone 6S never shows this error. All my other testing devices, from iPhone 7 ~ iPhone X, pop this error! This error exists since XCode 11. I updated it to XCode 12.4 hope that this error can be solved, but no luck! My development environment is 1. Delphi 10.4.1 2. iOS 13.7 3. XCode 12.4 4. macOS Big Sur 5. My app uses a location sensor component and timer components to activate the location sensor when loading up the App. (I want to try it in iOS 14.4 but cannot successfully get the iOS 14 SDK add to the SDK manager. Files in Z:\Documents\Embarcadero\Studio\SDKs\iPhoneOS14.4.sdk\usr\lib are in 0 byte. I tried it from XCode 12.0 to 12.3. All failed. I think it should be a bug in Delphi IDE. Only my old iOS 13.7 SDK is still working.) Does anyone know what causes this access violation error? Please help! BR. Leo -
Hello everyone, Full screenshot. How do I capture the entire screen? In this example, I can take a screenshot of the open form. Sample; function MakeScaleScreenshot(Sender: TObject): TBitmap; var fScreenScale: Single; function GetScreenScale: Single; var ScreenService: IFMXScreenService; begin Result := 1; if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) then begin Result := ScreenService.GetScreenScale; end; end; begin fScreenScale := GetScreenScale; Result := TBitmap.Create(Round(TfmText1(Sender).Width * fScreenScale), Round(TfmText1(Sender).Height * fScreenScale)); Result.Clear(0); if Result.Canvas.BeginScene then try TfmText1(Sender).PaintTo(Result.Canvas); // Sender.PaintTo( Result.Canvas); //, RectF(0, 0, Result.Width, Result.Height)); finally Result.Canvas.EndScene; end; end; procedure TfmText1.btnScreenClick(Sender: TObject); var B: TBitmap; begin B := MakeScaleScreenshot(Self); // MakeScreenshot(Image1); Image1.Bitmap.Assign(B); B.DisposeOf; end;
- 14 replies
-
- screen
- screenshot
-
(and 2 more)
Tagged with:
-
OpenSsl 1.1.1 library, why is it working without binding static libraries ?
Rollo62 posted a topic in Cross-platform
Hi there, I had some time to check out the great OpenSsl library from Grijjy / @Allen@Grijjy, and I found that its working even without binding any libraries to it. The original FMX sample showed some issues, so I just created a brand new Rx10.4.1 project and moved the main unit to it. Beside the Grijjy Foundation, I've put no static linked files yet in the deployment, to check this library out step-by step. Of coarse for Win32 I need the enclosed DLL's in the EXE folder, that's no surprise. It puzzled me that for Android and iOS, as well as for Macos, I don't need to add any library at all to the library tree/deployment Even in Allens post, there is the note, I've misinterpreted that it should be added directly to the projects library tree, or by deployment manager or some other hacky means: Also Embarcadero has notes about OpenSsl, Which leads to the conclusion at least iOS would need some external download of static libraries. In the libraries const section, I can spot the different static/dynamic names, but where and do they bind to ? const {$IF Defined(WIN32)} LIB_CRYPTO = 'libcrypto-1_1.dll'; LIB_SSL = 'libssl-1_1.dll'; _PU = ''; {$ELSEIF Defined(WIN64)} LIB_CRYPTO = 'libcrypto-1_1-x64.dll'; LIB_SSL = 'libssl-1_1-x64.dll'; _PU = ''; {$ELSEIF Defined(ANDROID64)} LIB_CRYPTO = 'libcrypto-android64.a'; LIB_SSL = 'libssl-android64.a'; _PU = ''; {$ELSEIF Defined(ANDROID32)} LIB_CRYPTO = 'libcrypto-android32.a'; LIB_SSL = 'libssl-android32.a'; _PU = ''; {$ELSEIF Defined(IOS)} LIB_CRYPTO = 'libcrypto-ios.a'; LIB_SSL = 'libssl-ios.a'; _PU = ''; {$ELSEIF Defined(MACOS32)} LIB_CRYPTO = 'libssl-merged-osx32.dylib'; { We unify LibSsl and LibCrypto into a common shared library on macOS } LIB_SSL = 'libssl-merged-osx32.dylib'; _PU = '_'; {$ELSEIF Defined(MACOS64)} LIB_CRYPTO = 'libcrypto-osx64.a'; LIB_SSL = 'libssl-osx64.a'; _PU = ''; {$ELSEIF Defined(LINUX)} LIB_CRYPTO = 'libcrypto.so'; LIB_SSL = 'libssl.so'; _PU = ''; {$ELSE} {$MESSAGE Error 'Unsupported platform'} {$ENDIF} I've put my test code as a wrapper around the original code, basically just adding the new project files. It seems the magic happens, because the libraries were sitting all side-by-side to the calling unit. The OpenSSL_Api unit find these local files in the same folder, and is able to bind them correctly. I didn't know that this is possible, I thought they have to be in the same project folder, and at least cross-platform make another hazzle to bind depending on the OS. Good to know that its enough to provide library+unit together, that gives much more room to cleanup libraries. I've put my wrapper code enclosed for testing, while the originally library files from Grijjy should be placed in the Src folder. The missing files you can get from here. I hope Allen don't mind. T381_GrijjySsl.zip -
good morning every one ^^ how is every one doing )) 1- i have fmx android app that s create sqllite db on create ,what's the location of db on the phone and is it const location ? (does not change for every other phones) 2- what's the proper way to copy it from that location to sd card (backup) ? thanks and take care
-
Hello, since Android 10 we've got this nasty problem of no longer having direct file access to such folders like TPath.GetSharedDownloadsDir. Now I have managed via some intent call to either ACTION_OPEN_DOCUMENT or ACTION_GET_CONTENT to display some file chooser and when the user selects one I get the Uri of the selected file. With that I can get at an JInputStream and could read out the individual bytes of that stream. But: how to get at the file size properly to know when to stop reading? The Available method should, as per Android's documentation https://developer.android.com/reference/java/io/InputStream#available() rather not be used. Is there any "wraper" available which properly/nicely wrapt this in a TFileStream or something similar? A quick search didn't turn up anything yet. TurboMagic
-
How to deal with requestLegavyExternalStorage in Android 10/11?
TurboMagic posted a topic in Cross-platform
I'm currently storing binary files generated by my app or uploaded to the device by the user (e.g. via Windows Explorer) in the public downloads path returned by TPath.GetSharedDownloadsPath. Using such a path which is not within the installed app itself is only possible in Android 10 when requestLegavyExternalStorage is being declared in the AndroidManifest.template.xml. But that is a solution only viable when targeting Android 10, but not when targeting Android 11, which will be a requirement somewhere in 2021. Now I'm looking for possible alternatives which come as close to what I currently have as possible. I have written a dialog listing all the files of my file type and when the user taps one he gets options to open it, display file meta data in a popup or share it via share sheet. I'm a bit lost about which route to go. I don't think MediaFramework would be the right approach as my file type is no media file. I've seen this one: https://developer.android.com/training/data-storage/use-cases#handle-non-media-files startActivityForResult( Intent(Intent.ACTION_OPEN_DOCUMENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = "*/*" putExtra(Intent.EXTRA_MIME_TYPES, arrayOf( "application/pdf", // .pdf "application/vnd.oasis.opendocument.text", // .odt "text/plain" // .txt )) }, REQUEST_CODE ) But I'm not really sure what it does. Ok, it calls some activity to select a file, but since my file type is binary with some specific suffix I'd like to list only files with that suffix and the other thing is: what do I get back? How do I get at my file's contents? And the other issue is, that the same dialog s used for saving files as well. They might be saved in some app package specific directory if share sheet can work for that, but it still would be more cumbersome for users having the device directly connected via Windows Explorer. They most likely couldn't get at the file anymore. Any ideas? -
my sample based on tip by Fernando Rizzato (MVP Embarcadero lead South America) unit uFormMain; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, System.Permissions, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Layouts, FMX.Controls.Presentation, FMX.StdCtrls, FMX.ListBox, FMX.Objects, FMX.ScrollBox, FMX.Memo, FMX.Media; type TfrmFormMain = class(TForm) lytFormMain: TLayout; lytFormMainToolBar: TLayout; lytFormMainClientArea: TLayout; tbarFormMainMenu: TToolBar; sbtnCAMStartCamera: TSpeedButton; cmbboxCAMDevices: TComboBox; imgVideoCapture: TImage; mmMyLog: TMemo; sbtnCAMStopCamera: TSpeedButton; procedure FormCreate(Sender: TObject); procedure sbtnCAMStartCameraClick(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure imgVideoCaptureTap(Sender: TObject; const Point: TPointF); procedure sbtnCAMStopCameraClick(Sender: TObject); procedure cmbboxCAMDevicesChange(Sender: TObject); procedure FormResize(Sender: TObject); procedure FormActivate(Sender: TObject); private procedure prcMyLog(lText: string); // procedure prcCAMDevicesSetting; procedure prcCAMStartCapture; // {$IF DEFINED(ANDROID)} procedure prcPermissionsResulted(Sender: TObject; const APermissions: TArray<string>; const AGrantResults: TArray<TPermissionStatus>); procedure prcDisplayRationale(Sender: TObject; const APermissions: TArray<string>; const APostRationaleProc: TProc); {$ENDIF} // procedure prcCAMSampleBufferReady(Sender: TObject; const ATime: TMediaTime); procedure prcCAMSampleBufferSync; public end; var frmFormMain : TfrmFormMain; FFormTopPositionBeforeResize: integer = 0; implementation {$R *.fmx} { This sample, will use the "TVideoCaptureDevice" (class base to "TCameraComponent") directly!!! This class is defined in "FMX.Media.pas" // TDialogService.ShowMessage() used for dont block main-thread! } // uses FMX.DialogService {$IF DEFINED(ANDROID)} , FMX.Helpers.Android, Androidapi.JNI.JavaTypes, Androidapi.Helpers, Androidapi.JNI.OS {$ENDIF} ; // var lMyCAMDevice : TVideoCaptureDevice; lMyCAMPermission: string; function fncMyIIF(lBooleanExpr: boolean; lTextTrue, lTextFalse: string): string; begin result := lTextFalse; // if lBooleanExpr then result := lTextTrue; end; procedure TfrmFormMain.prcMyLog(lText: string); begin mmMyLog.Lines.Add(lText); end; procedure TfrmFormMain.cmbboxCAMDevicesChange(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} try lMyCAMDevice := nil; // lMyCAMDevice := TVideoCaptureDevice(TCaptureDeviceManager.Current.GetDevicesByName(cmbboxCAMDevices.Selected.Text)); // sbtnCAMStartCamera.Enabled := not(lMyCAMDevice = nil); // except on E: Exception do prcMyLog('Error Start CAM' + #13#10 + E.Message); end; {$ENDIF} end; procedure TfrmFormMain.FormActivate(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} FFormTopPositionBeforeResize := Self.Top; { when the user move the forms, needs change it too! } {$ENDIF} end; procedure TfrmFormMain.FormClose(Sender: TObject; var Action: TCloseAction); begin if not(lMyCAMDevice = nil) then begin {$IF DEFINED(ANDROID)} // if PermissionsService.IsEveryPermissionGranted([lMyCAMPermission]) then; if PermissionsService.IsPermissionGranted(lMyCAMPermission) then {$ENDIF} begin if (lMyCAMDevice.State = TCaptureDeviceState.Capturing) then lMyCAMDevice.StopCapture; end; // // lMyCAMDevice.Free; // if necessary!!! end; end; procedure TfrmFormMain.FormCreate(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} FFormTopPositionBeforeResize := Self.Top; {$ENDIF} // // // Form.OnCreate is not better place to "critial" procedure! // Here, only basic procedures! // Self.Position := TFormPosition.ScreenCenter; sbtnCAMStopCamera.Text := 'Stop Cam'; // prcCAMDevicesSetting; // if necessary, move it for another place! // if not(lMyCAMDevice = nil) then begin prcMyLog(lMyCAMDevice.ToString); // unfortunatelly, dont have Name or Description on Mobile Android // sbtnCAMStartCamera.Enabled := True; end else prcMyLog('MyCAMDevice = nil'); end; procedure TfrmFormMain.FormResize(Sender: TObject); begin {$IF NOT DEFINED(ANDROID)} if (Self.Height <= 480) then begin Self.Top := FFormTopPositionBeforeResize; Self.Height := 480; end; // if (Self.Width <= 640) then Self.Width := 640; // to avoid that ComboBox is gone...! {$ENDIF} end; procedure TfrmFormMain.imgVideoCaptureTap(Sender: TObject; const Point: TPointF); {$IF DEFINED(ANDROID)} var lObject: string; {$ENDIF} begin {$IF DEFINED(ANDROID)} // for "TAPing" tests! // lObject := ''; // if not(Sender = nil) then lObject := Sender.ClassName; // TDialogService.ShowMessage( { } Format('Object=%s, Point X=%f, Y=%f, V[0]=%f, V[1]=%f, IsZero=%s', [ { } lObject, Point.X, Point.Y, Point.V[0], Point.V[1], { } fncMyIIF(Point.IsZero, 'is zero', 'is not zero') { } ])); {$ENDIF} end; procedure TfrmFormMain.prcCAMDevicesSetting; {$IF NOT DEFINED(ANDROID)} var DeviceList: TCaptureDeviceList; i : integer; {$ENDIF} begin {$IF DEFINED(ANDROID)} cmbboxCAMDevices.Visible := False; try // Normally, there is only 1 cam in Mobile! // // NOTE: any try to read or change any property from CAM, NEEDS "permissions"!!! lMyCAMDevice := TCaptureDeviceManager.Current.DefaultVideoCaptureDevice; // lMyCAMDevice.OnSampleBufferReady := prcCAMSampleBufferReady; // showing our video on TImage // // DONT TRY READ or CHANGE any property from CAMDevice here!!! // Like: Start or Stop, Quality, IsDefault, etc... // Only later your "permissions" to be given by user!!! except on E: Exception do prcMyLog('Error CAM definition' + #13#10 + E.Message); end; {$ELSE} DeviceList := TCaptureDeviceManager.Current.GetDevicesByMediaType(TMediaType.Video); // for i := 0 to (DeviceList.Count - 1) do cmbboxCAMDevices.Items.Add(DeviceList[i].Name); {$ENDIF} end; {$IF DEFINED(ANDROID)} // DisplayRationale and PermissionsResulted is used only mobile! procedure TfrmFormMain.prcDisplayRationale(Sender: TObject; const APermissions: TArray<string>; const APostRationaleProc: TProc); var lRationaleMsg: string; i : integer; begin for i := 0 to high(APermissions) do begin if APermissions[i] = lMyCAMPermission then lRationaleMsg := lRationaleMsg + 'This app needs access your CAM to works' + SLineBreak + SLineBreak; end; // // Show an explanation to the user *asynchronously* - don't block this thread waiting for the user's response! // After the user sees the explanation, invoke the post-rationale routine to request the permissions // TDialogService.ShowMessage(lRationaleMsg, procedure(const AResult: TModalResult) begin // TProc is defined in System.SysUtils // APostRationaleProc; // used by System to go-back in before function... end) end; procedure TfrmFormMain.prcPermissionsResulted(Sender: TObject; const APermissions: TArray<string>; const AGrantResults: TArray<TPermissionStatus>); begin // verifying if the permissions was granted! - Here, testing only 1 permission = CAM if (Length(AGrantResults) = 1) and (AGrantResults[0] = TPermissionStatus.Granted) then prcCAMStartCapture { execute your procedure here if all it's ok } else TDialogService.ShowMessage('The permission <<CAMERA access>> not allowed by user'); end; {$ENDIF} procedure TfrmFormMain.prcCAMSampleBufferReady(Sender: TObject; const ATime: TMediaTime); begin // ****** // DONT USE "main thread" to process something "critial" like: process images by Cam // or anyother that can "crash" your UI (user interface) or app!!! // *************************************************************** // If exist images to process, then, put it on a "queue" to execute it! // Here, "prcSampleBufferSync" will be called always in a queue from main thread (your app) // to "dont paralize it" while the images it's processed!!! // // .............."main thread".........."method called" // TThread.Queue(TThread.CurrentThread, prcCAMSampleBufferSync); // end; procedure TfrmFormMain.prcCAMSampleBufferSync; begin // // use your imagination, to redirect this buffer !!! :) // // in the meantime ... let's write the pictures coming from the camera in the TImage lMyCAMDevice.SampleBufferToBitmap(imgVideoCapture.Bitmap, True); // end; procedure TfrmFormMain.prcCAMStartCapture; begin if not(lMyCAMDevice = nil) then begin // to Mobile (Android), change properties from CAMERA, needs permission! {$IF DEFINED(ANDROID)} if PermissionsService.IsPermissionGranted(lMyCAMPermission) then {$ENDIF} begin try lMyCAMDevice.StopCapture; // to avoid any error below // lMyCAMDevice.Quality := TVideoCaptureQuality.PhotoQuality; // lMyCAMDevice.StartCapture; // starting video capture! // prcMyLog('CAM device = Capture stated!'); prcMyLog('CAM ' + fncMyIIF(lMyCAMDevice.IsDefault, 'is', 'is not') + ' Default'); prcMyLog('CAM ' + fncMyIIF(lMyCAMDevice.HasFlash, 'has', 'has not') + ' Flash'); except on E: Exception do prcMyLog('Error Start CAM' + #13#10 + E.Message); end; end {$IF DEFINED(ANDROID)} else TDialogService.ShowMessage('Then CAM device needs your permission to access it!'); {$ENDIF} end else TDialogService.ShowMessage('None CAM device defined!'); end; procedure TfrmFormMain.sbtnCAMStopCameraClick(Sender: TObject); begin if not(lMyCAMDevice = nil) then begin // Needs "permissions" to read or change CAM properties! // {$IF DEFINED(ANDROID)} if PermissionsService.IsPermissionGranted(lMyCAMPermission) then {$ENDIF} begin if (lMyCAMDevice.State = TCaptureDeviceState.Capturing) then lMyCAMDevice.StopCapture else lMyCAMDevice.StartCapture; end {$IF DEFINED(ANDROID)} else TDialogService.ShowMessage('The <<CAMERA access>> permission is necessary'); {$ENDIF} end; end; procedure TfrmFormMain.sbtnCAMStartCameraClick(Sender: TObject); begin {$IF DEFINED(ANDROID)} PermissionsService.RequestPermissions( { } [lMyCAMPermission], { } prcPermissionsResulted, { } prcDisplayRationale { = nil, if you DONT WANT show any message! } ); {$ELSE} prcCAMStartCapture; // MSWindows or macOS {$ENDIF} end; initialization lMyCAMDevice := nil; {$IF DEFINED(ANDROID)} lMyCAMPermission := JStringToString(TJManifest_permission.JavaClass.CAMERA); {$ENDIF} finalization end. hug
-
Latest Delphi Trying to send email from Android that is always sent to one address but can have up to 3 CC addresses......the send to address shows up ok in the email but not any of the CC addresses. The code I use is shown below. Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_SEND); sRecipients := TJavaObjectArray<JString>.Create(1); sRecipients.Items[0] := StringToJString(Recipient); ccRecipient := TJavaObjectArray<JString>.Create(1); ccRecipient.Items[0] := StringToJString(ccTechs); Intent.putExtra(TJIntent.JavaClass.EXTRA_EMAIL,sRecipients); Intent.putExtra(TJIntent.JavaClass.EXTRA_CC, ccRecipient); Intent.putExtra(TJIntent.JavaClass.EXTRA_SUBJECT, StringToJString(aSubject)); Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT, StringToJString(aBody)); Intent.setType(StringToJString('plain/text')); TAndroidHelper.Activity.startActivity(TJIntent.JavaClass.createChooser(Intent, StrToJCharSequence('Which email app?'))); The ccTechs variable is a string of addresses - each address separated by a comma. All works fine except the ccRecipient is always missing. Can someone please explain what I am doing wrong. Thanks in advance Bill Zwirs
-
I have firedac datasnap server connected to mssql database server. I am using dbx connection from my firemonkey client app that is running on android mobile. Since I have different datasnap servers using the same App, how is it possible to acquire the IP address of the datasnap server with a parameter from client side. Can someone help me on this issue.
-
Hello, I started to develop an Android application with Delphi Tokyo, the application works on any devices. Then I developed the update with Delphi Rio and I have some issues when updating the application on some devices: the application freezes when opening. I had to remove application, delete files, restart the device and reinstall the application. On a new device or a device that has never had the application, I didn't have any problem. Due to lack of time, I could not solve this problem. Now I'm developing a new update on Delphi Sydney, the problem is still there and it's gotten worse: all of updated devices don't work. On a new device or a device that has never had the application, I don't have any problem again. It's a weird thing and I don't have any clue... Regards