Reputation: 440
I would like to add sms and email native services (similar to Dialer service) to a Gluon application. I have seen some information regarding the previous version "gluon charms down", but nothing for the later version "gluon attach" ...
Is it still possible to add my own native services in a gluon app using "gluon attach"? I am using maven with com.gluonhq:client-maven-plugin:0.1.32
Upvotes: 2
Views: 186
Reputation: 440
Alright, so the only way I found was to generate my own version of attach, with the additional service. There are 2 steps (in bold) which are unexpected:
A.Make a copy of https://github.com/gluonhq/attach
create a new module 'e.g.mynative' as a copy of an existing one. in the new module rename files and ids accordingly
in settings.gradle add lines:
include 'mynative'
...
project(':mynative...
add the lines:
static jclass jMynativeServiceClass;
...
jclass substrateGetRinkainativeServiceClass() {
return GETREGISTERCLASS(jMynativeServiceClass,
"com/gluonhq/helloandroid/DalvikMynativeService");
}
./gradlew publishToMavenLocal
B. Make a copy of https://github.com/gluonhq/client-maven-plugin
mvn clean package install
C. Consume service in your gluon mobile app
update version for client-maven-plugin plugin and attach dependency to the ones used in the steps above i.e. xxx-SNAPSHOT
in com.gluonhq:client-maven-plugin configuration add mynative to attachlist
use as other attach services, e.g
Services.get(MynativeService.class).ifPresent(service -> {
System.err.println("connected:"+service.connectedProperty().get());
});
Then to run on android:
mvn -o -P android clean client:build client:package client:install client:run
I have not tried it on IOS
Upvotes: 1