Help with a macro

With some help I have created a macro that when my Bluetooth enabled hearing aid turns on, if I am within the Geo-fence of home, it will open the app for controlling the hearing aid, and then select the program that I have created. That is where the issue is, to get to the button or tab that I want it to press involves swiping right to see it.
So far under actions I have: If Device Connected (hearing aid)
Launch app
UI Interaction Click [id.sonvova.phnak.dsapp.id/home_program_item_II]

There is the problem, it will not select the program that I want it to select. I managed to use ADB to install the helper app, so I could use X, Y location, but it does not show up when I attempt to use it. As the screenshots show, this is what the app looks like. The first one is what I see upon opening the app, the second one is what I want to press (1) I have tried to have it do it via text, but that does not work, I suspect because of the star in front. If anybody could offer me some assistance on this, I would be grateful. The phone is a Pixel 6a with Android 14
Screenshot_20240110-122015.pngScreenshot_20240110-122015.png
 

Josué García

MacroDroid Support
Staff member
With some help I have created a macro that when my Bluetooth enabled hearing aid turns on, if I am within the Geo-fence of home, it will open the app for controlling the hearing aid, and then select the program that I have created. That is where the issue is, to get to the button or tab that I want it to press involves swiping right to see it.
So far under actions I have: If Device Connected (hearing aid)
Launch app
UI Interaction Click [id.sonvova.phnak.dsapp.id/home_program_item_II]

There is the problem, it will not select the program that I want it to select. I managed to use ADB to install the helper app, so I could use X, Y location, but it does not show up when I attempt to use it. As the screenshots show, this is what the app looks like. The first one is what I see upon opening the app, the second one is what I want to press (1) I have tried to have it do it via text, but that does not work, I suspect because of the star in front. If anybody could offer me some assistance on this, I would be grateful. The phone is a Pixel 6a with Android 14
View attachment 8188View attachment 8189
Sorry I can't see what are you trying to interact with in the second picture, exactly what are you trying?
 

dhj49er

Well-known member
I have Oticon Hearing Aids and have similar macros, although the Oticon Connect app is different and I don't have as many programs!

UI integration action should work fine.

The issue with your macro is your are not allowing time for actions to complete eg launch program will take a few hundred milliseconds to complete.

Consequently your macro should look like

Launch app - use force new and check that the app always opens on the same page irrespective of the last page viewed.
Wait 250 ms (might need to be longer, depends on phone)
UI Gesture action - to scroll screen to the left
Wait 250ms
UI Click (x,y) - I would use this approach and find the x&y values for all the programs, which you might need eg for switching back?
Wait 250ms
Launch home screen - to exit the app
 
I have Oticon Hearing Aids and have similar macros, although the Oticon Connect app is different and I don't have as many programs!

UI integration action should work fine.

The issue with your macro is your are not allowing time for actions to complete eg launch program will take a few hundred milliseconds to complete.

Consequently your macro should look like

Launch app - use force new and check that the app always opens on the same page irrespective of the last page viewed.
Wait 250 ms (might need to be longer, depends on phone)
UI Gesture action - to scroll screen to the left
Wait 250ms
UI Click (x,y) - I would use this approach and find the x&y values for all the programs, which you might need eg for switching back?
Wait 250ms
Launch home screen - to exit the app
Thanks, but the issue I am having right now is that I can not determine the X, Y position, I tap the option to Overlay, and it does nothing at all, I suspect because this is Android 14, and according to Google, the helper app does not work with this version, which is why I had to sideload it and tell it to ignore the security warning.
 

dhj49er

Well-known member
I activate the pointer location and read the X & y values off the ribbon at the top of the screen as I move the on screen pointer.

Have you tried that method?
 

dhj49er

Well-known member
I am not seeing that option
It's not an option in MD

It's a feature in Android ..accessed via Developer Options

I've attached a screenshot of a macro that toggles the system setting.
 

Attachments

  • Screenshot_20240111_180329_MacroDroid.jpg
    Screenshot_20240111_180329_MacroDroid.jpg
    404.6 KB · Views: 6

Josué García

MacroDroid Support
Staff member
Thanks, but the issue I am having right now is that I can not determine the X, Y position, I tap the option to Overlay, and it does nothing at all, I suspect because this is Android 14, and according to Google, the helper app does not work with this version, which is why I had to sideload it and tell it to ignore the security warning.
There is an alternate way to do this
Here is a tutorial how to enable developer options and then use the finder and search (pointer location) that setting should activate the coordinate bar

(even if your device is not Samsung, they all have the same build number and pointer location, in any case it should be very similar)
 
It's not an option in MD

It's a feature in Android ..accessed via Developer Options

I've attached a screenshot of a macro that toggles the system setting.
OK, I enabled the location bar, got the location (X600, Y0) but the macro is still not pushing the appropriate option. I have attached a screenshot of the macro.Screenshot_20240111-131752.png
 

Josué García

MacroDroid Support
Staff member
For example, if the application takes 2 seconds to open, define for example 3 seconds so that you do not have errors, in the 2nd interaction set less time, for example 1 second.
 

dhj49er

Well-known member
OK, I added wait time, and it still does not select the program I wish it to.
View attachment 8193
The click (600,0) is one issue.

Where on the screen are the program buttons?

In order for y=0 to work they would need to be in the status bar, which they aren't, so this action is not doing what you want.

Is the double gesture working correctly?
 
The gesture(s) are not working, I adjusted the X, Y numbers, and it still does not. As you can see, the program/button I want is 1, the first ss is what I see when opening the app, the second is where the program I want is.
Screenshot_20240111-153919.pngScreenshot_20240111-154214.pngScreenshot_20240111-154226.png
 
Top