Use kdeconnect:// url to trigger commands
ClosedPublic

Authored by nicolasfella on Jun 9 2018, 8:17 PM.

Details

Summary

Make it possible to trigger commands by opening an URI like kdeconnect://runcommand/<deviceid>/<commandid>
Makes it possible to trigger commands from NFC tags.
To ease the setup the url can be added to the clipboard

Test Plan

Long-press a command entry
Select Copy URL to clipboard
Write into NFC tag or use kdeconnect-handler to trigger url
See command executing

Diff Detail

Repository
R225 KDE Connect - Android application
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nicolasfella created this revision.Jun 9 2018, 8:17 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptJun 9 2018, 8:17 PM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
nicolasfella requested review of this revision.Jun 9 2018, 8:17 PM
  • Remove leftover log
apol added a subscriber: apol.Jun 12 2018, 8:57 AM

Wow cool! :)

Can you upload a screenshot of what it looks like? When does the context menu show? on long tap?

Do you know how it works in practice? The device needs to be unlocked right?

In D13447#277319, @apol wrote:

Wow cool! :)

Can you upload a screenshot of what it looks like? When does the context menu show? on long tap?

Do you know how it works in practice? The device needs to be unlocked right?

Yes, it shows on long tap

I tested it with an NFC tag. You will need an external app to actually write it. The device needs to be unlocked, right. The only slightly tricky thing is finding the spot where your phones NFC sensor is. I can include a subtle vibration to indicate when the tag was recognized to indicate that it was successful

apol added a comment.Jun 13 2018, 4:42 PM
In D13447#277319, @apol wrote:

Wow cool! :)

Can you upload a screenshot of what it looks like? When does the context menu show? on long tap?

Do you know how it works in practice? The device needs to be unlocked right?

Yes, it shows on long tap

I tested it with an NFC tag. You will need an external app to actually write it. The device needs to be unlocked, right. The only slightly tricky thing is finding the spot where your phones NFC sensor is. I can include a subtle vibration to indicate when the tag was recognized to indicate that it was successful

Yes, I've written nfc tags myself, it needs some work to find the antenna yes. Not much we can do anyway.

And vibration could be useful so the user doesn't need to look at the phone.

  • Errorhandling++ and subtle vibration on success
  • Whitespace--
albertvaka accepted this revision.Jul 26 2018, 6:32 PM
albertvaka added a subscriber: albertvaka.

The command IDs are quite ugly because they contain "{" which are not safe on URLs. This patch is fine, though, we can change it by changing the generation of those IDs on the desktop side, so they don't have these braces (only for newly-generated IDs).

Eg of a runcommand URI:
kdeconnect://runcommand/_b5e53f8d_0fc6_47f4_9fcc_3bae11da8a0b_/{c3c1cbbe-e182-4ae6-a451-21cf3ff39d79}

src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandUrlActivity.java
69

Maybe a toast is enough?

This revision is now accepted and ready to land.Jul 26 2018, 6:32 PM
This revision was automatically updated to reflect the committed changes.