android intents: how to get them?
-
My app is very normal, with a boring AndroidManifest.xml and the intent filter with the two lines to make it show up on the homescreen.
Now I want to add a second way for the app to start; namely when a scheme is activated.
<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:scheme="secret" /> </intent-filter>
So, when a webpage asks for that scheme, my app should start.
The question is, how do I get hold of all the details. For instance if I listen to "tel" as the scheme and the full intent is "tel:12345". How do I get access to the '12345' ?
Anyone knows?
-
OK, the solution seems to be:
- Create a Java class to inherit QtActivity.
- Reimplement onNewIntent there
- Use QJniEnvironment.registerNativeMethods() and Java 'native' methods to allow passing in the intent or the data from that intent to the C++ code.
The documentation on the site is still far below general Qt level, but improving since 6.7 which I massively appreciate and I only managed to solve this by switching from the 6.5 docs to the 6.7 docs.
-
OK, the solution seems to be:
- Create a Java class to inherit QtActivity.
- Reimplement onNewIntent there
- Use QJniEnvironment.registerNativeMethods() and Java 'native' methods to allow passing in the intent or the data from that intent to the C++ code.
The documentation on the site is still far below general Qt level, but improving since 6.7 which I massively appreciate and I only managed to solve this by switching from the 6.5 docs to the 6.7 docs.
-