Forum / NoMachine for Mobile / Automatically connect to a physical desktop from Android
Tagged: Android
- This topic has 4 replies, 2 voices, and was last updated 1 year, 4 months ago by Wellee.
-
AuthorPosts
-
July 24, 2023 at 14:48 #44941WelleeParticipant
Hi!
Is it possible to automatically connect to a remote computer from Android app?
On Ubuntu I’m doing it this way:
[Desktop Entry] Type=Application Name=NoMachine client Exec=/usr/NX/bin/nxplayer --session "path to the NXS file" --exit Icon=NoMachine Comment=NoMachine client automatic session X-GNOME-Autostart-enabled=true
But I don’t know how to do it on Android. I have access to adb shell with root.
Is it possible?
July 27, 2023 at 18:15 #44991TorParticipantYou can use the intent, try this:
adb shell am start -a android.intent.action.VIEW -d file:///storage/emulated/0/Android/data/com.nomachine.nxplayer/files/NoMachine/Connection\\ name.nxs -t application/octet-stream
Change the file “Connection name.nxs” in the example to the name you need, and remember to double escape spaces. You could also need to change the path of the NXS file, usually they are saved in the scoped storage, but you could have also a /sdcard/NoMachine directory.
The first time you’ll do it, the system will show you a list of applications compatible with that mime type. Select NoMachine and toggle “Remember my choice”.
When the application starts check the “Don’t show this message again” switch in the welcome panels, so the next time the connection will start immediately.July 27, 2023 at 19:22 #44992WelleeParticipantThanks Tor! That worked!
Is it possible to run NoMachine when Android boots and run this command?
Thanks again.
July 28, 2023 at 14:39 #45001TorParticipantHappy to know it works!
If you want to automatically run the application, you can look for an automation app in the store and configure a macro to open an NXS file with NoMachine. You can select the trigger (device boot, screen unlock, wifi state change, button presses, etc) and the action to execute (in our case “open file”).
I’ve tried a couple of simple apps but I didn’t manage to start the application correctly after the device boots up. However I tried to run it when the screen unlocks, and it worked beautifully. Nice idea, thanks for sharing it!July 28, 2023 at 15:40 #45002WelleeParticipantThanks for your reply Tor!
For anyone having this same problem, I managed to run NoMachine and automatically connect to a remote computer on Android boot adding a shell script under /data/adb/service.d
The script contains:
sleep 15
am start -a android.intent.action.VIEW -d file:///sdcard/Android/data/com.nomachine.nxplayer/files/NoMachine/connection.nxs -t application/octet-streamIt is necessary to have installed Magisk.
Cheers!
-
AuthorPosts
This topic was marked as solved, you can't post.