Change system Proxy settings using Android SDK - android

I'm migrating a Google Chrome extension that I made to an Android version, but I'm facing some questions.
It is basically a Proxy server for certain websites that were blocked in my country. This is working on Chrome by changing the proxy settings with our proxy and with a PAC file that specifies which sites should be proxied.
How can I change the system proxy settings using the Android SDK? Is it doable? If not, what suggestions do you have to have this done?
Thank you so much.

Ok, so after A LOT of investigation, I concluded that this is not a good idea. Also, in most recent Android versions, use an app to set a proxy is mostly impossible.
I've decided a different approach and use a VPN. It works, but is not as lightweight as I would like it to be.

Related

failing to open my app after changing proxy

I want to do performance testing of an android app.For this, I need to set manual proxy with a port.But, when I change the proxy with some port number (like 8181 or 8282) I not able to open the app.If I opened also not able the send the request of that app to the app server.
How to solve this problem.
Based on the tags, it seems you are trying to script a test scenario using JMeter. You mentioned that the app stopped working after setting the proxy. Could you confirm that you had started the JMeter proxy before changing your proxy settings?
You can have a look at this document for step-by-step instructions on setting up JMeter proxy-
https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
If you are using the latest version of JMeter, there will slight differences in the options, but overall instructions should help you get started.

How to use the embedded Flash on Android?

I know that Flash has been abandoned on the Android platform. But for a special reason, I still need to use Flash (SWF file) on an application that is used internally. So, now is there a way to make my application play Flash(has ActionScript) without installing other APK?
The minimum version of the target device is Android 4.4 (API 19)
Thanks a lot.
I was investigating same thing recently. Adobe AIR seems to be able to do it so I was pretty sure it's possible. After quite a lot of googling I found some useful info and proof of concept on some Chinese website (unfortunately it's already down :( ).
Fortunately they also linked a Github repository with that example. I was able to fork it and add some instructions about which files do you need to update if you want to use latest AIR SDK or see flash traces.
So there you go. You can use SWF file in your Android app (on new Intent) through AIR-runtime, without installing other APK:
android-invoke-adobe-AIR
There's one problem tho. You can pass some parameters from Java to AS3, but I couldn't find easy way for communicating between them later on. In AIR you could do that via ANE's and I was trying to extract some APKs to see how it works, but no luck. I did end up using socket communication (it's on feature/SocketConnection branch).
Hope you find it usefull.

Android - Orbot Built-in App

NOTE: If you have no idea what TOR or Orbot is, check out this links below:
https://www.torproject.org/
So, I was wondering if possible to add TOR support to my app. This would save the user alot of stress looking for a working proxy and besides, TOR is one of the most safest proxies out there.
Im aware that the The TOR team made an app called "Orbot" which allows Android devices to proxy apps using orbot. The problem is, the only way for Orbot to proxy apps is if they have ROOT and some users do not like taking techy approaches, especially when it has "THIS COULD BRICK YOUR DEVICE!" so I thought if its possible to rip out the Orbot source and add it to my app so my app gets proxied.
This can save lots of people from downloading multiple apps and cut time on setting this up (since my app has to have proxy support to be proxied through TOR which I havent seen much of so i really have no idea on how to have something like this) but im not sure where in the source code is the actual routing to the TOR network and thought i could get a little boost in this.
Im not trying to make my own Orbot, i will give credit
So, does anyone know where to start? I decompiled the regular Orbot app and skimmed through the source but not much rings a bell.
Thanks!
Use ORlib, which "is an Android Library for use by any application that wishes to route its network traffic through Orbot/Tor".
If you want to avoid forcing user to install Orbot, you can include Tor in your application using this project which includes Orbot's tor binary and allows full control over it.

Creating Android vpn profile

I want to Programmatically create vpn profile; somehow i figure out how to access android.net.vpnmanager and android.net.vpn.vpnprofile (they are not part of offical API and are part of hide APIs) but they have no function create new vpn profile. any suggestions?
Using Hidden APIs is not a good idea as there is no guarantee that with an update they will still work as intended, moreover there is no guarantee that they will work in a consistent manner across different devices manufactured by different vendors.
Android 4.0 ICS has a VPN client API but again it allows you to create your own VPN client.
The only reason I can think of as to why you cannot access VPN settings just as you will access wifi settings is the inherent nature of VPN connections. Here is a link to the VPN features in ICS4.0. The first part of the document discuss these risks. You can still write your own client for your app.
http://developer.android.com/reference/android/net/VpnService.html
Another approach can be to use a third party VPN client and check if you can pass any actions to it via an intent. My recommendation if you are targeting ICS only will be to go with the client API as that you know how your code is working.
I thinkt that VPN Android isn't yet on a stable release, there are a couple of other clients besides the built-in there. But there's so many changes between the last versions of Android regarding the VPN and proxy settings. At the beginning there aren't any VPN support at all, then you can only get that rooting your device and now there's a kind of stable native VPN client inside Android but like you noted, lack of documentation in many aspects and other bugs too.
My recommendation would be to wait to create your code after we have a slightly more stable VPN Android and documentation. If you can't or don't want to wait, go forward with that undocumented API, it could change in the future but I don't see any better option right now.
If You are using a phone from Motorola look into using this as it has code to create working vpn connections using L2tp and Pptp
http://developer.motorola.com/docs/Motorola_Enterprise_Device_Management_SDK_Getting_Started/

Android - How can I programmatically add a VPN network

The Settings on Android provides an option to add VPN manually.
Can this be done programmatically through some kind of an API?
I'm not looking for a way to connect to a VPN. I'm only concerned about configuring a VPN profile.
Please see this answer, it is not possible with the Android SDK.
This is not possible with Android SDK. However, some manufactures like
Motorola have their own flavor of android and in their SDK they have
made it possible.
See also this question -- Create VPN profile on Android. Briefly, we came to the conclusion that it's not only not possible with the Android SDK, but it's not possible even with a hacked SDK unless you have a rooted device (because the VPN profiles are stored via the system KeyStore, so you would need to be running as a system process to add / modify them).
However, there does appear to be a third-party VPN app that at least claims to do this without a rooted device, but it doesn't appear to be open-source and I can't vouch for it (see the comments here: http://code.google.com/p/android/issues/detail?id=8915).

Categories

Resources