termux / termux-api

Termux add-on app which exposes device functionality as API to command line programs.
https://f-droid.org/en/packages/com.termux.api/
2.28k stars 452 forks source link

termux-notification set clipboard on action doesn't work #311

Open dnarvaez27 opened 4 years ago

dnarvaez27 commented 4 years ago

Problem description Trying to set the clipboard from a notification action but text is not set and the previous state is kept.

Steps to reproduce From Termux: termux-notification --action "termux-clipboard-set some-text"

Expected behavior After clicking the notification and running termux-clipboard-get or pasting anywhere, 'some-text' should be inserted

Additional information Android version: 9 CPU arch: aarch64

xalexalex commented 4 years ago

Can't reproduce. Do you have the latest termux-api android package and termux package? (i.e. update from play store/f-droid and pkg up in termux)

dnarvaez27 commented 4 years ago

Yeah, I do have the app and the API updated. Altough, I forgot to mention that this happens only when termux is not showing in the phone screen, like in background.

ghost commented 4 years ago

I forgot to mention that this happens only when termux is not showing in the phone screen, like in background.

More like Android restriction for background application launch.

Currently, api commands just launch Termux:API application with passing some arguments through intent. That behaviour may not be desired by Android OS.

It may be useful (?) to generate a log (adb logcat) to check what is happening.

Having persistent API service may resolve the issue. There some work done for TermuxAPIService in https://github.com/termux/termux-api/pull/233.

drui9 commented 1 year ago

Devs out here use clipboard set/get to check for foreground activity. Should those be changed, we'd need alternatives.