timer trigger not working when macrodroid not in foreground aka clipboard monitor work around

Hello!

My automation relied heavily on the clipboard update monitor, which is no longer available. :.(

My solution, run a timer to run my macro once per second.

- copy clipboard contents to macrovariable clipboardcurrent
- compare to macrovariable clipboardlast
if not equal then update clipboardlast with value from clipboardcurrent and then do something cool

The problem is something cool only happens once i select the macrodroid app into the foreground again.

It seems the macrodroid timer is not working when the app is in the background even if its running.

Any tips are much appreciated.

As an aside, I looked at using intent as a workaround for clipboard updated but unfortunately there was nothing because the apps USE clipboard to broadcast intents. So to go intent round I think I would have to talk to the speech to clipboard pro app maker and ask him to put an intent into his app so I we could monitor it on macrodroid?

anyway, I would love to have a quick solution here if there's any ideas about it or maybe I'm missing something here??
 

420

Active member
Hello!

My automation relied heavily on the clipboard update monitor, which is no longer available. :.(

My solution, run a timer to run my macro once per second.

- copy clipboard contents to macrovariable clipboardcurrent
- compare to macrovariable clipboardlast
if not equal then update clipboardlast with value from clipboardcurrent and then do something cool

The problem is something cool only happens once i select the macrodroid app into the foreground again.

It seems the macrodroid timer is not working when the app is in the background even if its running.

Any tips are much appreciated.

As an aside, I looked at using intent as a workaround for clipboard updated but unfortunately there was nothing because the apps USE clipboard to broadcast intents. So to go intent round I think I would have to talk to the speech to clipboard pro app maker and ask him to put an intent into his app so I we could monitor it on macrodroid?

anyway, I would love to have a quick solution here if there's any ideas about it or maybe I'm missing something here??
In regards of the timer (i assume you mean a regular interval trigger?) all i can say is to make sure the option to "use alarm" is ticked and to follow the steps at dontkillmyapp.com

There are some changes in the last MD update that might be able to help you with this though;

Added logcat option to support Clipboard Trigger for users of android 10+ (Root/ADB hack)

Added clipboard refresh action for android 10+ users

I'm not familiar with any clipboard related macro triggers/actions myself, so i'm not sure, but if these changes mean that it will work for you again then it would be alot better then running a macro every single second.
 
Thank you so much for your swift response on this!

I tried using the alarm option and then I experienced something interesting...

when I went back to macrodroid I got three speech announcements (something cool)

so maybe my trouble is that speech is only happening when macrodroid is in the foreground?
 

tanutanu

Well-known member
Probably @420 is correct. Only foreground app can access the clipboard content on Android 10+ device as security reason. The interval doesn't seems to have any problem(no, it has another issue, but no relation to this).

If a MD variables stored a value in advance, you can paste it to another app even when MD is background, on non-rooted or non ADB hacked devices. You need to send the value to MD via Intent, http get, reading a file or notification and any other data sources.

And another question about TTS has no relation with foreground/background. It is working correctly on all my devices.
 
Last edited:
The next version of MacroDroid will have the ability to get the clipboard contents in a convenient way and also a clipboard trigger that will work on Andorid 10 using the ADB hack.
That would be amazing!
No pressure but any idea when that might be? I can put it on my calendar to come back to this.

In the meantime I started studying android app development just gotta get some wifi to download that huge ass file for studio
 

420

Active member
That would be amazing!
No pressure but any idea when that might be? I can put it on my calendar to come back to this.

In the meantime I started studying android app development just gotta get some wifi to download that huge ass file for studio
It is already released, if it is not available for you yet then it should be soon..
 
UPDATE:
last night I made a clause:

Cron once per second

If clipboard = myemptyvariable
Speak its empty

If clipboard != mylastclipboardvariable
Speak shipboard updated

If clipboard = mylastclipboard variable
Speak nothing changed

As long as Macrodroid was in the background, my clipboard, even if full, reported empty to Macrodroid

For example, even if clipboard was equal to my last clip entry, as soon as I navigate away from MD it reports "its empty"

Then if I navigate back to MD
"Nothing changed"
Meaning the clipboard was revealed again.

I did find some.settings to change in secure.folder that's supposed to allow apps access to the clipboard but couldn't get my function working as desired
 
It is already released, if it is not available for you yet then it should be soon..
Ahh... I misread your reply...
I re-read this thread and see you were referring to the root / adb

I see you also said:
clipboard refresh action for android 10+ users

How can I learn more about this?
What is "clipboard refresh action" and how do I use it?

I've been very resistant to rooting my phone because I want to make my solution easy to use for many users, even if they don't root the phone.
 

420

Active member
Ahh... I misread your reply...
I re-read this thread and see you were referring to the root / adb

I see you also said:
clipboard refresh action for android 10+ users

How can I learn more about this?
What is "clipboard refresh action" and how do I use it?

I've been very resistant to rooting my phone because I want to make my solution easy to use for many users, even if they don't root the phone.
For this new clipboard trigger you need either root OR the ADB hack, not both of them. (ADB hack might still not be easy for many users, but i think it is do-able for most, especially with @Jacob L 's video and .bat file)

I made a screenshot of the info pop-up for the clipboard resfresh action for you, apart from that i cannot really tell you more about it :p
 

Attachments

  • Screenshot_20211028-191444.png
    Screenshot_20211028-191444.png
    137.1 KB · Views: 10
For this new clipboard trigger you need either root OR the ADB hack, not both of them. (ADB hack might still not be easy for many users, but i think it is do-able for most, especially with @Jacob L 's video and .bat file)

I made a screenshot of the info pop-up for the clipboard resfresh action for you, apart from that i cannot really tell you more about it :p
Amazing!!
I'll see if I can find that and try it out!!
 
  • Like
Reactions: 420

MacroDroidDev

Administrator
Staff member
Just to be clear this feature is only available on beta and this is not a fully rolled out beta (I'm proceeding cautiously on this release as there are major changes that can break things). The beta should be 100% available to all beta users in the next few days.
 
One work around I found was to abandon voice clipper pro and instead use Google Assistant along with IFTTT.
I don't love it because this solution cannot work in Offline mode.

For it to work, I Went to IFTTT and created a rule: when google assistant receives command: Myhotword $whateverelseIsaid then IFTTT passes $whateverelseIsaid as a notification on the IFTTT app on my phone. Macrodroid can then process $whateverelseIsaid by parsing the IFTTT notification text with my command parser on Macrodroid.
 

420

Active member
One work around I found was to abandon voice clipper pro and instead use Google Assistant along with IFTTT.
I don't love it because this solution cannot work in Offline mode.

For it to work, I Went to IFTTT and created a rule: when google assistant receives command: Myhotword $whateverelseIsaid then IFTTT passes $whateverelseIsaid as a notification on the IFTTT app on my phone. Macrodroid can then process $whateverelseIsaid by parsing the IFTTT notification text with my command parser on Macrodroid.
Have you tried AutoVoice plugin? It works for me but not when i set it to offline mode, maybe because i don't use it with english, i don't know..
 
Thank you for the reminder..
I had tried it before and didn't love it but maybe if I dig a little deeper it can work better. I'll check it out again thanks!
 
  • Like
Reactions: 420
Top