termux-api icon indicating copy to clipboard operation
termux-api copied to clipboard

termux-notification set clipboard on action doesn't work

Open dnarvaez27 opened this issue 6 years ago • 4 comments

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

dnarvaez27 avatar Dec 18 '19 17:12 dnarvaez27

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)

xalexalex avatar Dec 18 '19 22:12 xalexalex

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.

dnarvaez27 avatar Dec 19 '19 15:12 dnarvaez27

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.

ghost avatar Dec 19 '19 15:12 ghost

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

drui9 avatar Aug 09 '23 10:08 drui9