0

I am beginner in android and developing an app where I want to connect to an existing VPN connection (already configured in the android settings) during startup.

So far, I was able to open the settings activity via intent:

Intent intent = new Intent(android.provider.Settings.ACTION_VPN_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

But I don't want to click every time I open the app manually to connect.

Is there a way to click programmatically? I think there should be a way, because the app "Automagic Premium" goes exactly that way, but I don't know how.

I found for example:

View.performClick()

but how to get the view of the currently started intent?

Or is there another way to connect?

I tested also the VpnService class, but here it seems that there is only the possibility to create new profiles and using your own service implementation. That's not really what I am looking for.

I read lot of posts but found no satisfactory solution. Hope one of you can help me out? I am happy with every kind of hint. Thanks

0 Answers0