Closed schroedingersZombie closed 2 years ago
Hi,
happy to hear you are building a custom service :-).
There are two options implemented into the client to call Android intents:
Actions.clientControlFun
Actions.addButtonCustomFunction
The corresponding service actions are:
ACTIONS.CLIENT_CONTROL_FUN
ACTIONS.BUTTON_CUSTOM_FUN
The PLATFORM_CONTROLS
command is using them, maybe it helps to check it out:
/sepia-assist-API/src/main/java/net/b07z/sepia/server/assist/services/PlatformControls.java
There is some more info in the SEPIA Teach-UI examples that might help.
Basically "clientControlFun" can trigger everything that is available via SepiaFW.client.controls.handle
which is (v0.24.0):
var availableControls = {
"settings": Controls.settings,
"alwaysOn": Controls.alwaysOn,
"volume": Controls.volume,
"media": Controls.media,
"searchForMusic": Controls.searchForMusic,
"clexi": Controls.clexi,
"platformFunction": Controls.platformFunction,
"meshNode": Controls.meshNode,
"runtimeCommands": Controls.runtimeCommands
}
platformFunction
is the one to look out for. Via "controlData" you can pass "android" as platform and request type "androidActivity" or "androidBroadcast" which will call SepiaFW.android.intentActivity(req.data)
or SepiaFW.android.intentBroadcast(req.data)
.
There might be some limitations to the SepiaFW.android.intent...
functions. What would you like to call?
In your service you can use the platform feature if you want to make sure the client can actually handle Android intents:
//Check platform
Platform platform = CLIENTS.getPlatform(nluResult.input.clientInfo);
if (platform.equals(Platform.browser)){
...
}else if (platform.equals(Platform.android)){
...
}else{
...
}
*/
Hope that helps :slightly_smiling_face:
Thank you! I think that helps. I got diverted by the remoteAction :D But I think I now know the way forward.
Hi,
I've created a smart service and would like it to call an Android intent via the client app on my smartphone. I've found the sendRemoteAction in the ServiceBuilder, but the client code does not seem to have a handler for calling intents sent via this method. Am I missing something or is there currently no way to do this?
I think I would be able to implement this in the client code, if it is not possible yet, and create a PR. Would the file www/scripts/sepiaFW.webSocket.js in the client app in the lines following 2154 be the correct point to start this?