Android Question [SOLVED] Launch Service and simulate tap

Sabotto

Well-Known Member
Licensed User
From my app, with these instructions, I can launch a service (OpenVPN) that allows me to connect to my VPN.
B4X:
Dim i As Intent
i.Initialize(i.ACTION_MAIN, "")
i.SetComponent("de.blinkt.openvpn/.LaunchVPN")
i.PutExtra("de.blinkt.openvpn.shortcutProfileName", "VPN_Telecontrollo")
StartActivity(i)
The screen appears but then I have to "tap" manually on my profile.


In your opinion, it is possible to automate everything, that is to start the service and also start the profile (as if I had done tap manually?)
Thanks
 

sfsameer

Well-Known Member
Licensed User
Longtime User
Hello,

You can simulate the taps without needing to have rooted device, there is a service in android called : AccessibilityService

Extra Information :
1- Using this service the user will have to enable it first before the service can run
2- Difficult to implement (It took us 2 weeks to implement it in our project Teamviewer Alternative) because you will need to exact X,Y of the screen to simulate the touches

Example by the amazing @moster67 :

Another Example by us :


Thank you,
Saif
 
Upvote 0

Sabotto

Well-Known Member
Licensed User
I was actually looking for something that could add some parameters or instructions to the ones I used to start the app and at the same time use that profile
 
Upvote 0

sfsameer

Well-Known Member
Licensed User
Longtime User
I was actually looking for something that could add some parameters or instructions to the ones I used to start the app and at the same time use that profile
Hello,

Because your question is :
(as if I had done tap manually? )

So check out the examples above and you will get better understanding of how does the AccessbilityService work and you can start from there.

Thank you,
Saif
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…