EN | RU
aurora_intent
A plugin for working with intents in the Aurora OS. Aurora OS Intents Documentation
The plugin allows you to:
- call intents
- register your own interns
Example :
await AuroraIntent.invokeIntent(
name: "MyIntent"
);
AuroraIntent.initialize();
await AuroraIntent.registerIntent("X-MyIntent", (_) async {});
await AuroraIntent.startService();
Contents
- Installation and build
- Detailed description
- Compatibility
- Terms of use and participation in development
Installation and build
Add the plugin depending on the target application in the pubspec.yaml file:
dependencies:
aurora_intent:
And update the dependencies:
flutter-aurora pub get
Detailed description
invokeIntent
Calling an intent in the Aurora OS
Future<Map<String, dynamic>> invokeIntent({required String name, Hints? hints, Map<String, dynamic>? params});
Arguments
-
name- name of the intent:- standard
AuroraStandartIntents:-
Start- to start any actions or processes; -
OpenURI- to open a specific URI;
-
- custom;
- standard
-
hints- hints for the intent service; -
params- an arbitrary collection of parameters.
Return value
A сollection of return values from the intent handler
Example
Opening the settings app:
await AuroraIntent.invokeIntent(
name: AuroraStandartIntents.start,
hints: Hints(
preferredHandler: "com.jolla.settings",
),
);
initialize
Registering background handlers for the plugin
AuroraIntent.initialize();
registerIntent
It saves the handler for the internet and passes the intents for registration to the Runtime Manager. For a single intent, we save a single handler. When an intent is called, the app will always open and display the GUI.
Future<void> registerIntent(String name, Future<JsonMap?> Function(Map<String, dynamic> params) callback);
Arguments
-
name- invent name, name is eitherOpenURIor it starts with "X-"; -
callback- the intent handler method.
Example
Registering an intent that returns the original parameters:
await AuroraIntent.registerIntent("X-MyIntent", (params) async {
return {"params": params};
});
Registering your own intents in a desktop file:
Intents=X-MyIntent
Registration of URI schemes in a desktop file:
MimeType=x-scheme-handler/geo
Intents=OpenURI
IANA approved schemes are supported (https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml ) and a diagram starting with "aurora-.". Avoid using "_" in schema names.
To prevent intents from being deleted during auto-generation, you can remove the comment in the desktop file`:
- # This file will be recreated at the next build. To avoid this, delete this line.
Testing URI schemes
Use the dbus command:
gdbus call -e -d ru.omp.RuntimeManager -o /ru/omp/RuntimeManager/Intents1 -m ru.omp.RuntimeManager.Intents1.InvokeIntent OpenURI "{}" "{'uri':<'geo:12,12'>}"
startService
It registers the added intents in the Runtime Manager, after which the interns become available for calling by the OS.
Future<void> startService();
Compatibility
The plugin has been working correctly since the 5.2 version of the Aurora OS and Flutter 3.35.0.
The plugin works with restrictions on version 5.1 and Flutter < 3.35.0:
- you cannot transfer data with more than 1 level of nesting, such as nested json objects;
- when running the command
flutter run, the registration of custom intents does not work. It will only work when the app is launched through the app icon.
Terms of use and participation in development
The source code of the project is provided under license, which allows it to be used in third-party applications.
To participate in the development of the project, please read the participant agreement. If you plan to send your source code for inclusion in the project, you will need to accept the terms of the CLA.
Information about the participants is provided in the [AUTHORS] file(AUTHORS.md ).
Code of Conduct is the current set of rules of the Open Mobile Platform company, which informs about the expectations for interaction between community members when communicating and working on projects.