WestyOz
-
Content Count
4 -
Joined
-
Last visited
Posts posted by WestyOz
-
-
Thanks Brian for the unofficial fix - I've applied this and it works.
Just a couple of things I had to tweak though. In the .bat file I had to adjust as follows:
rem set SDK_PATH=%PUBLIC%\Documents\Embarcadero\Studio\20.0\PlatformSDKs\android-sdk-windows set SDK_PATH=%PUBLIC%\Documents\Embarcadero\Studio\20.0\CatalogRepository\AndroidSDK-2525_20.0.32429.4364\
And in the FMXNativeActivity.java, I had to explicitly add the import of java.util.ArrayList (got an exception otherwise)
import java.util.ArrayList; . . . private List<String> mRegisteredIntentActions; . . . protected void onCreate(Bundle savedInstanceState) { // Check device architecture DeviceArchitectureChecker.check(); // Debugger if (CLASSES_DEX_DEBUGGER_SUPPORT) { DebuggerUtils debuggerUtils = new DebuggerUtils(this); debuggerUtils.tryStartDebugger(); } virtualKeyboard = new VirtualKeyboard(this); mRegisteredIntentActions = new ArrayList<String>(); mRegisteredIntentActions.add(NotificationInfo.ACTION_NOTIFICATION); mRegisteredIntentActions.add(NotificationPublisher.ACTION_GCM_NOTIFICATION); super.onCreate(savedInstanceState);
I am no expert in this space - so not sure if this is the ideal approach but it seemed to work.
-
Thanks for the reply and insights Dave it is much appreciated - and indeed you are exactly right. With your reference I went back to Delphi 10.2.3 and inspected FMXNativeActivity.java and note the declaration as:
private List<String> mRegisteredIntentActions;
and in the onCreate() it is updated as:
. . . mRegisteredIntentActions = new ArrayList<String>(); mRegisteredIntentActions.add(NotificationInfo.ACTION_NOTIFICATION); mRegisteredIntentActions.add(NotificationPublisher.ACTION_GCM_NOTIFICATION); . . .
So there has been a step change between versions, which must have been for a reason?
-
It appears that when using Delphi 10.3 and targeting the latest Android API (26) the following call no longer works: MainActivity.registerIntentAction(TJIntent.JavaClass.ACTION_VIEW);
The exception is raise 'java.lang.UnsupportedOperationException'.
This was required when facilitating the handling the opening of an associated file using an <intent-filter> within the AndroidManifest.template.xml. The full code sequence is as follows:
// Register the type of intent action that we want to be able to receive. // Note: A corresponding <action> tag must also exist in the <intent-filter> section of AndroidManifest.template.xml. MainActivity.registerIntentAction(TJIntent.JavaClass.ACTION_VIEW); TMessageManager.DefaultManager.SubscribeToMessage(TMessageReceivedNotification, HandleActivityMessage);
I've had the same challenge when running the AndroidIntents project from the supplied Samples.
Has anyone else encountered this and managed to solve for it?
Delphi 10.3 | Android : registerIntentAction -> java.lang.UnsupportedOperationException
in Cross-platform
Posted
In regards to the java error it was compile time error -> 'Cannot find symbol'. Again, I'm no expert with java - so I just applied the first Dr Google suggestion and got a result.
Also it was the Web Install rather than the ISO. First time I've gone this way on a Delphi install and the paths are different between versions (compared to 10.2 on my machine at least).
And again, thanks for taking the time to document and supply a fix for the Delphi community. I'm sure I'm not the only one that has had a headache over this so to get a solid resolution whilst a patch is developed was gratefully received.