-
Content Count
1334 -
Joined
-
Last visited
-
Days Won
29
Posts posted by Dave Nottage
-
-
5 hours ago, darnocian said:I would expect it to only happen when actually pasting from the clipboard - not while typing keys
Do you have a minimal reproducible example?
-
15 hours ago, vfbb said:This will avoid almost all permissions being denied
Understood, however there will always be someone, and they may still contact support to ask why the app is not working 😉
-
1
-
-
56 minutes ago, Kas Ob. said:Is it possible to clear app data and cache to force resetting user permissions setting ?
As far as I can work out, it's not possible to revoke permissions from within an application, however it is possible external to the device, using adb:
https://stackoverflow.com/a/32683390/3164070
I'm not sure what the use case would be for being able to do it from within the app other than for testing purposes, and that's covered by using adb as per the link above.
-
I've improved the experience somewhat, by opening the App Info screen instead using this code:
var LIntent: JIntent; LUri: Jnet_Uri; begin LUri := TJnet_Uri.JavaClass.fromParts(StringToJString('package'), TAndroidHelper.Context.getPackageName, nil); LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_APPLICATION_DETAILS_SETTINGS, LUri); LIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); TAndroidHelper.Context.startActivity(LIntent); end;
Then the user only has to:
- Tap "Permissions"
- Tap "Location"
- Select the appropriate option (e.g. "Allow All The Time")
- Use the app switcher to switch back to the app, or use the back arrow/button 3 times
Still not great, but better 🙂
-
I have code that requests location permissions at runtime, however of course the user might deny that permission. In case they made a mistake, or change their mind, I want to be able to give the user the opportunity to grant the permission because attempting to request the permission in code will result in the user not being prompted, and the permission being denied.
Unfortunately, there does not seem to be an easy way (at least on Android 11) of providing this. The following code will show the Location Permissions settings for the device:
var LIntent: JIntent; begin LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_LOCATION_SOURCE_SETTINGS); TAndroidHelper.Activity.startActivityForResult(LIntent, 0); end;
However the user then has to - Tap the "App access to location" item:
Scroll down to the "Denied" section and tap the app in question:
Then select whichever option is appropriate (for this particular app it's "Allow all the time")
Then the user needs to either tap the back arrow until the settings screens disappear (Cannot use the app switcher to switch back to the app)
This is obviously a horrible user experience. Does anyone know of a better way?
-
10 hours ago, David Schwartz said:This looks great, except I can't get the compiler to find the Tidy method:
Tidy is a method of TJson (via a class helper), not TJsonObject. It's also a class method, so you don't need an instance of anything to call it
-
6 hours ago, David Schwartz said:It seems if you have quoted strings that contain things like "... 100% satisfaction ..." or "... a 10% discount..." in an input string, the call to doc.Format here:
I used @Lars Fosdal's code:
https://github.com/DelphiWorlds/Kastri/blob/672522381e8fe192f562cdcb95b9f473b08fc0b6/Core/DW.REST.Json.Helpers.pas#L77
Works better than the Format method, for me 🙂-
1
-
-
On 7/11/2021 at 4:16 AM, dkounal said:In an android application just a Delphi form and its dependencies add 30MB in the file .so of the application.
I'd be looking at what exactly is contained in that form - perhaps some graphics (in TImage etc) that may be larger than necessary?
-
On 7/1/2021 at 3:53 AM, billyb said:I do not have option to find error address, this is Delphi FMX IOS app.
Is debugging from the IDE not working for you?
-
13 minutes ago, corneliusdavid said:my target SDK is only at 25.2.25
I guess I did not explain it well enough. The value you quoted is not the targetSdkVersion that I mentioned - it is the version of the installed SDK, which has absolutely nothing to do with targetSdkVersion, platform API level, or pretty much any other value that is important to Android development.
-
1
-
-
8 hours ago, MikeMon said:But the official Embarcadero docwiki 10.4 Sydney - Release 2 - RAD Studio (embarcadero.com) states that it does.
To clarify: Android 11 is supported. The distinction is in the value for targetSdkVersion that ends up in AndroidManifest.xml (currently, the value is set to 29, as opposed to 30). A targetSdkVersion of 30 is yet to be fully supported, as it requires changes to the support of accessing external storage (and possibly other aspects of API 30). This is what is being referred to with a statement of:
8 hours ago, MikeMon said:API 30 is not officially supported with 10.4.2
They really should make the distinction if they are saying it like that.
Also, targeting an API level (via targetSdkVersion) and building against an API level are 2 completely different things, so downloading platform API level 30 and changing the SDK settings to suit is not the same as changing the target.-
3
-
-
14 hours ago, Dalija Prasnikar said:There is no need to uncheck those.
Sorry, I missed the "additional" part 🙂
-
15 hours ago, Fabian1648 said:I don't see how to put the proposed solution into practice
Please refer to this part of the answer:
On 6/28/2021 at 5:15 PM, Dalija Prasnikar said:you will need to add those additional files to deployment manually.
i.e. you would need to uncheck all of these:
..and add your own, keeping the same Remote Path and Remote Name values
-
On 5/29/2021 at 8:07 PM, Fabian1648 said:Is there a solution with FMX to have an events listener that detects all the events that are triggered in an app?
By "events", if you mean things like whether the app became active, entered the background etc, you can have the app subscribe to TApplicationEventMessage:
http://docwiki.embarcadero.com/Libraries/Sydney/en/FMX.Platform.TApplicationEventMessage
Use TMessageManager to subscribe to the event, e.g:
TMessageManager.DefaultManager.SubscribeToMessage(TApplicationEventMessage, ApplicationEventMessageHandler);
..and to unsubscribe when you no longer wish to receive the messages:
TMessageManager.DefaultManager.Unsubscribe(TApplicationEventMessage, ApplicationEventMessageHandler);
Example handler:
procedure TMyClass.ApplicationEventMessageHandler(const Sender: TObject; const M: TMessage); var LMessage: TApplicationEventMessage; begin LMessage := TApplicationEventMessage(M); case LMessage.Value.Event of TApplicationEvent.BecameActive: DoAppBecameActive; TApplicationEvent.EnteredBackground: DoAppEnteredBackground; // etc end; end;
-
1
-
2
-
-
18 hours ago, vrelisean said:but my CFBundleName isn't the problem
Can you indicate what value you have for CFBundleName? See also: https://quality.embarcadero.com/browse/RSP-32150
-
13 hours ago, Alex Texera said:Where create provisioning profile?
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Steps_in_Creating_Multi-Device_Applications#If_your_application_targets_either_macOS_or_iOS
See steps 5 and 6 -
50 minutes ago, Chester Wilson said:Cam := TJCamera.Create; //Crashes here
You do not create an instance of JCamera using Create. As per the documentation:
To take pictures with this class, use the following steps:
-
Obtain an instance of Camera from
open(int)
.
-
Obtain an instance of Camera from
-
10 hours ago, Rollo62 said:I wonder if it would be possible to intercept the texture stream
I have been working on that. I needed to make a substantial change to using an OpenGL surface - a problem I am having is doing a transform when the device is not oriented in the "normal" position.
10 hours ago, Rollo62 said:I find the (for Android)
FSurfaceTexture: JSurfaceTexture;
FSurfaceTextureListener: JTextureView_SurfaceTextureListener;
which leads to the assumption that this could be tapped somehow.That already is "tapped", however the SurfaceTextureListener is not the right place. As per my comment above, I've switched to using GLSurfaceView: https://developer.android.com/reference/android/opengl/GLSurfaceView
Which uses: https://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer
The GLSurfaceView calls onDrawFrame of the Renderer when a new frame is available, so the capture/filtering can be done there. This part is all done in Java, however the Delphi code could "hook" into the filtering, and can already pass a Java bitmap of the resulting frame to Delphi. Again as per above, I want to resolve the transform issue which is currently eluding me.
I'm willing to share the work in progress with others if they think they can help. Best to join my Slack workspace to do so: https://slack.delphiworlds.com
-
1
-
-
1 hour ago, Chester Wilson said:Otherwise my option seems to be getting / writing a java wrapper for camera2 - which looks pretty daunting!
It was pretty daunting for me:
Native Camera for iOS and Android – Delphi Worlds
There's still a number of issues to resolve...
-
1
-
-
22 hours ago, Ranja AZ said:I want to convert java code to delphi code.
It appears you have already asked a similar question, here: https://stackoverflow.com/questions/65345853/is-it-possible-to-write-the-following-java-program-in-delphi
The principal for your present issue is identical, i.e. if OnPrintListener is a class, then you. cannot do it in Delphi. If it's an interface (which, given your other question, it's likely), then you already have an example of how to implement a Java interface, in the StackOverflow answer. A possible example for this case:uses Androidapi.JNIBridge, Androidapi.JNI.JavaTypes, Androidapi.Helpers; type JOnPrintListener = interface; JOnPrintListenerClass = interface(IJavaClass) ['{076904DD-77D9-497D-BA21-992A9B8FED3E}'] end; [JavaSignature('com.nexgo.oaf.apiv3.device.printer.OnPrintListener')] JOnPrintListener = interface(IJavaInstance) ['{F688775D-067F-4521-A045-9106599F4C4A}'] procedure onPrintResult(retCode: Integer); cdecl; // *** NOTE *** There may be other methods for this interface end; TJOnPrintListener = class(TJavaGenericImport<JOnPrintListenerClass, JOnPrintListener>) end; TRunnable = class(TJavaLocal, JRunnable) private FCallback: TProc; public { JRunnable } procedure run; cdecl; public constructor Create(const ACallback: TProc); end; TPrintListener = class(TJavaLocal, JOnPrintListener) private FRetCode: Integer; FRunnable: JRunnable; procedure DoRun; public { JOnPrintListener } procedure onPrintResult(retCode: Integer); cdecl; public constructor Create; end; { TRunnable } constructor TRunnable.Create(const ACallback: TProc); begin inherited Create; FCallback := ACallback; end; procedure TRunnable.run; begin FCallback; end; { TPrintListener } constructor TPrintListener.Create; begin inherited; FRunnable := TRunnable.Create(DoRun); end; procedure TPrintListener.DoRun; begin // Do the toast thing here, using FRetCode end; procedure TPrintListener.onPrintResult(retCode: Integer); begin FRetCode := retCode; TAndroidHelper.Activity.runOnUiThread(FRunnable); end; { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin // Assuming FPrintListener is defined as: FPrintListener: JOnPrintListener FPrintListener := TPrintListener.Create; // Assuming you have created an instance of Printer (imported as JPrinter) called FPrinter FPrinter.startPrint(False, FPrintListener); end;
Note all of the assumptions being made - the biggest one being that OnPrintListener is an interface. Also I don't have the .jar, nor the printer, so of course it is untested
-
3
-
-
4 hours ago, Ranja AZ said:can I convert this java file to .pas file with this tools?
Unlikely. Such tools are to create imports from .jar or .class files, not convert Java code to Delphi.
Your main problem will be whether OnPrintListener is a class or an interface, because you cannot implement a descendant of a Java class in Delphi - it needs to be done in Java. Java interfaces however, can be implemented in Delphi by creating a descendant of TJavaLocal, and implementing the interface in question. There are a number of examples of descendants of TJavaLocal throughout the Delphi source.In order to determine what OnPrintListener is, you could use the aforementioned tools to import the Java classes from the .jar that you mentioned, assuming that it is the one that contains com.nexgo.oaf.apiv3.
-
3 hours ago, Halcon said:I can't find any method for save and get images that can view on the phone gallery
Since iOS 8, use the PhotoKit framework to access photos in albums:
PhotoKit | Apple Developer Documentation
I have an import for it, here:
https://github.com/DelphiWorlds/Kastri/blob/master/API/DW.iOSapi.Photos.pas
Which likely needs updating, because I think I imported it around iOS 9 era. This will not help you however, if you are saving photos as files somewhere. You can retrieve the filename from an asset in the gallery, bearing in mind can be traps in doing so:
https://medium.com/@slk11075/traps-for-phasset-how-to-get-filename-from-phasset-67d856e75c64
-
2
-
1
-
-
If you haven't already, try using a different cable
-
1
-
-
1 hour ago, Beppe Magistro said:these variables remain in red , may be are not more defined in
FMX.PushNotification.Android;
Are you actually including that unit in your source? If so, where you have declared it, please use Ctrl-Click or right-click and Open File At Cursor. It should find it in the Delphi source in the fmx folder. If it finds it anywhere else, that's probably the issue.
How to get the actual UTC time??
in General Help
Posted
You might want to read this: