Android :: How To Set HTTP Proxy In Programmatic Way?
Sep 2, 2010
I'm looking for a programmatic way to set-up http proxy settings for android handsets. I've tried using android.provider.Settings.System.putString() to set System.HTTP_PROXY, but my call fails (I'm using a 2.2 emulator image at the moment). My code looks like:
if (System.putString(getContentResolver(), System.HTTP_PROXY, "10.10.2.1:8080")) {
tv.append("put for HTTP_PROXY succeeded. ");
} else { tv.append("put for HTTP_PROXY failed. "); }
I've also added to my android manifest:
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
Although it's not clear from the docs which permission, if any, is required.
I'm familiar with this SO thread, but the technique there requires manual adb commands, which require the SDK tools and (possibly) a rooted phone. Is there a way to accomplish this? Ideally, I'd like away to set an http proxy that will be used for both data and WiFi connections.
View 1 Replies
Oct 22, 2009
I am developing applications for Android in a company where the Internet is accessable via a proxy server only. I found out that the emulator of the 1.5 R3 SDK works well with the option -http-proxy, but the emulator of the 1.6 R1 SDK does not. Is this a bug in the 1.6 R1 SDK? And if so, is there a chance this gets fixed in - let's say - 1.6 R2? Or am I just doing something wrong, though providing the same options for the 2 different emulator versions?
View 9 Replies
View Related
Jan 12, 2010
I'm developing android application in my university that must use the internet through proxy server. In Android SDK 1.5 I use parameter - http-proxy when starting emulator and it working. But since Android SDK 1.6 until now (2.1) this approach is not working.
View 4 Replies
View Related
Apr 26, 2009
I have set up proxy in the sdk emulaotor and can access internet via the proxy in the browser. but this does not work for my http connection application, it gives "Unknown host exception" i have used -dns-server option when launch the app.
View 2 Replies
View Related
Jul 6, 2009
I had tried to use the sqlite3 to add a proxy information in the com.android.providers.settings/databases/settings.db, but I still couldn't access the Internet through browser on a real device. I had also tried to use the ProxySetting ap to set proxy. It couldn't work either. Is there any idea to set the http proxy on a real device?
View 2 Replies
View Related
Feb 19, 2010
I am trying to configure http_proxy settings for Internet access from Android emulator (behind a proxy). I tried following options:
1. -http-proxy option using emulator command.
2. setting http_proxy environment and then launching the emulator.
3. Settings proxy using APN settings (Telkilla) (this worked till Android 1.6 version)
4. adding an entry in settings. CODE:.........
I also checked -debug-proxy log messages and it showed below messages
CODE:..............
How can we access Internet from emulator (behind a proxy).
View 11 Replies
View Related
Mar 24, 2009
I am having a specific problem that is preventing me using the android SDK from work. We are using a MS Proxy here that all internet traffic has to go through. The problem seems to be when the emulator is trying to access a site that uses 'Transfer-Encoding: chunked' If I attempt to download www.nds.com (no chunked encoding) into the browser, it works fine. However if I try to go to www.google.com (uses chunked encoding), the browser fails with the message: can't determine content length, and client wants to keep connection opened My feeling (and I'm no expert in this area) is that the underlying code managing the communication through the proxy is not dealing with the null terminator on the chunk encoded response when the connection to the proxy is being kept open? Does anyone have any experience in this area? Is the source to the emulator available so I can try and understand what is going on here?
View 8 Replies
View Related
Nov 30, 2011
When I connect to the student's wifi network, it requiers to configure the proxy with authentification. Well I'm fine with that, and the browser works all right, but all of the apps which require internet access aren't working. I also noticed, that when I'm configuring the proxy in the settings, it actually says that the HTTP proxy will be used by the browser, but not by some of the apps (in my case none of the apps work, including the pre-installed apps like android market, youtube or google maps).
So my question is that is there any way to make the apps work with the HTTP proxy? I should say that I found this thread on this forum:
[URL]
but I had trouble understanding it. Also if this matters, I'm using an Asus Eee Pad Transformer running android 3.2.1.
View 9 Replies
View Related
Jul 8, 2010
My provider only permits me to connect to the internet via the web-browser. Only the web-browser works. I want to use the Android market, but it doesn't connect. Is there some sort of proxy I could use to get around this? I can connect to the market if I'm on my home WiFi, but not if I'm on my network GPRS.
View 13 Replies
View Related
Apr 29, 2014
My problem is that all my devices are on a wifi network that uses http/https/ftp/SOCKS proxy settings to connect to internet. All the devices connect to internet after I use proxy settings on them. But few applications such as skype do not connect to internet. They work fine when I connect to a wifi network that does not use any proxy settings (at home), but at work when I have to use proxy settings to access internet, the apps fail to connect. I have a couple of devices which are not rooted (Fujitsu Stylistic M532 tablet, Garmin-Asus A10 phone) and I am not sure if I can root them. I would really want to use all the apps.
View 9 Replies
View Related
Nov 3, 2011
I am tring to debug an android app. I need to pass all the http trafic of my htc desire s through a proxy server( Paros, WebScarab, etc.) that i have on my pc. I need to intercept the http messages.
I have rooted the phone and installed a proxy on it. I have connected the phone and the pc to the same wifi so that they will be in the same network. After this i have put the pc's ip in the Proxy Host: "192.168.1.2" and the port "8080" on the Proxy Port field because Paros Proxy uses 8080.
View 1 Replies
View Related
Sep 25, 2010
I'm at complete odds over configuring a proxy to inspect the HTTP(S) traffic for the app I'm developing. I've tried running Fiddler2 and Charles Web Proxy, both run on 127.0.0.1:888, and starting up the Android emulator with the parameter:
To test it out I open the Android browser. I see in Fiddler2 that the request is routed through the proxy. However, only RARELY does the request receive a successful response. In most, and when I say most I mean 99% of the time, the request is retried and fails again with the Android browser telling me "The server failed to communicate". Has anyone found a way to configure Fiddler2 or Charles for debugging HTTP(S) traffic through the Android emulator?
View 1 Replies
View Related
Aug 4, 2009
How can I take a screenshot programmatically? So far I've learned that:
1) DDMS does it by sending "framebuffer:" to the adb service over a socket, which takes a screenshot in framebuffer_service.c that it sends back.
2) There are some proprietary screenshot apps out there that stipulate the user must have root access, I'm not sure why.
Would it be possible for an Android app to send "framebuffer:" to its own adb service and get the screenshot that way?
View 7 Replies
View Related
Apr 1, 2010
Has anyone seen or compiled benchmarks comparing declarative (XML) versus programmatically created UI's in Android? There are things that Google has done to speed up the declarative approach, but you still do have the layout inflation step done at runtime. Have you ever switched (or considered) changing your UI from declarative to programmatic for any reason?
View 1 Replies
View Related
Feb 3, 2010
I need to add some parts of my UI programmatically. I'm doing this because I need to set the ids of some elements up in such a way that they can be easily access in a for loop. So far I have this xml:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/attr_row" android:layout_width="fill_parent"
android:layout_height="wrap_content"> <EditText android:id="@+id/attr_name"
android:hint="Attribute" android:layout_width="0dip" android:layout_weight="2"
android:layout_height="wrap_content" android:inputType="textPersonName" />
<EditText android:id="@+id/attr_val" android:hint="Value"
android:layout_width="0dip" android:layout_weight="3"
android:layout_height="wrap_content" android:inputType="textPersonName" />
<ImageButton android:id="@+id/drop_attr" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="@drawable/btn_delete_states"
android:layout_gravity="center_vertical" /> </LinearLayout>
At the moment, I inflate this xml five times like so:
for (int i = 0; i<5; i++) { LinearLayout attrList = (LinearLayout) findViewById (R.id.attr_list);
LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(R.layout.attr_row, null);
LinearLayout extraAttr = (LinearLayout) row.findViewById (R.id.attr_row);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
attrList.addView(extraAttr, i, params); }
The link below shows two pictures - the layout hierarchy and the result in the emulator. http://picasaweb.google.com/bengoldcross/Android?authkey=Gv1sRgCJ785I...
As can be seen, the xml is inflated five times successfully but only one is actually displayed. Inspecting the hierarchy viewer a bit more explains why. The layout being displayed is at location x=0 y=111 all the others are being rendered at x=320 y=111. It would appear they are being displayed a) off screen and b) on top of each other. So, why are they and how do I stop it from happening?
View 3 Replies
View Related
Aug 26, 2010
Been stuck on this for a while and tried a few various things.Basically I've overridden frame layout to create myself a custom button. The frame layout has two children a button and a linearlayout with items in it.The problem is I'm trying to the get the button to stretch to the size of the frame layout (i.e. fill parent) and it isn't doing.
View 1 Replies
View Related
Sep 15, 2010
I want to mount SD card programmatic, how can I check?
View 1 Replies
View Related
Mar 1, 2010
I'm wondering how programmatic sd card mounting/unmounting can be achieved while the handset is connected to a pc via USB. I cannot find any managed API for that and also my jni attempts failed with errno: 1, [Operation not permitted] error.
View 1 Replies
View Related
May 12, 2010
I wanted to know if it is even possible to either set up or modify email account settings programmatically. I do not believe it is, due to email applications controlling their own settings (and thus would depend upon a ContentProvider from that specific client), but I have not yet found a definitive "no", either.
Further, I was wondering about the email account support on Android in general. It appears that Android 2.0 and above will allow for multiple ActiveSync/Exchange accounts and mulitple IMAP/POP3 accounts, and displays these in the same inbox. Is this claim true? Also, how is this different from the other major Android releases (Android 1.5 and 1.6)?
View 1 Replies
View Related
Feb 3, 2010
Is there a programmatic way to read the system logs? i know they are stored in /dev/log.
View 4 Replies
View Related
Sep 6, 2010
I am trying to understand the main differences between registering a BroadcastReceiver in the Manifest and registering it programmatically...
My understanding is basically as follows - would appreciate someone correcting my points if I am missing something.
Registered in Manifest:
- The OS will magically find and instantiate your class if needed, calling the onReceive() method, regardless what the running state of your application was
- Your receive will only get called once per broadcast (i.e. You can consider that registering in the manifest is like registering your 'class' for receiving the broadcast - and the broadcast instantiates your class as needed) (??)
Registered Programmatically:
- registering in code means that you are registering instances of your class to receive broadcast messages (i.e. if your code is a little sloppy, and you manage to register several times, you will end up with multiple BroadcastReceiver instances all having their onReceive() called for a broadcast
- to deregister, you need to deregister the specific BroadcastReceiver instance that you previously registered
- if your application gets destroyed by the OS, your onReceive() method will not be called for a broadcast
View 1 Replies
View Related
Aug 27, 2010
I would like to implement some sort of remote assistance tool (like vnc) for Android. Is there the possibility to capture a screen programmatically on the device?
View 3 Replies
View Related
Jun 16, 2009
If a RelativeLayout must be generated at run time, what are the equivalent API calls for the attributes set in the XML Layout editor? Take for example this very simple RelativeLayout that places the second ImageView to the right of the first ImageView:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/ android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal" android:background="@drawable/ bg_sunrise"
android:layout_gravity="center" android:gravity="center">
<ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon"></ ImageView>
<ImageView android:id="@+id/ImageView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/ ImageView01" android:src="@drawable/icon"></ImageView> </RelativeLayout>
Of the many, variations I tried, I had the most hope for this one, but it didn't work either:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
RelativeLayout layout = new RelativeLayout(this);
layout.setLayoutParams( new ViewGroup.LayoutParams (
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT ) );
ImageView imageView1 = new ImageView(this);
imageView1.setImageResource(R.drawable.icon);
imageView1.setAdjustViewBounds(true);
// set the ImageView bounds to match the Drawable's dimensions
RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params1.addRule(RelativeLayout.ALIGN_PARENT_TOP); layout.addView(imageView1, params1);
ImageView imageView2 = new ImageView(this); imageView2.setImageResource(R.drawable.icon);
imageView2.setAdjustViewBounds(true); // set the ImageView bounds to match the Drawable's dimensions
RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams
(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params2.addRule(RelativeLayout.RIGHT_OF, imageView1.getId());
layout.addView(imageView2, params2); this.setContentView(layout); }
Can anyone offer the Java equivalent to the above XML? Can anyone explain why there is no attribute, getter/setter, or method for accessing the properties that can be set in XML? What is the most elegant solution for dynamically creating Layouts, Views, and other Resources on the Android platform when there is no Java programmatic equivalent?
View 11 Replies
View Related
Feb 28, 2010
I want to populate a table, defined in layout xml file through the programmatic way. I have define Table with a single row defining its header, with all the attributes set. Now i want to know a way so that i can just replicate that header row in the table with new content.
I tried using inflator inflate(int,view) method, but at runtime it showed up with error.
Here is the XML code for the layout file defining the table
CODE:.................
View 1 Replies
View Related
Oct 4, 2010
I'm having with the wi-fi on android. As many of us know, android has no native support for proxies, unfortunately my school's network uses a proxy server to access the internet. I have a wireless router connected to the network so i can have wireless on my laptop and such. What I was wondering was, can I use the router to allow my android phone to access the internet as well? I reckon it's just a matter of forwarding the right ports to the phone but I'm not sure which ports are in use. I'm using a htc desire and a d-link dir-600 router.
View 4 Replies
View Related
Jul 14, 2009
"android:scrollbars" are used in XML layout file to declare whether a view having scrollbar. I would like do it programmatic. according to api doc, there seems no direct peer method. Should I have to read a attr xml file? http://developer.android.com/reference/android/view/View.html
View 3 Replies
View Related
Aug 10, 2009
With this SDK version I can use my emulator using a proxy server. There is three solutions: - add values in system table - configure -http-proxy in eclipse run menu - configure APN on emulator to set the proxy. When I use Android browser, it's really slow but it's working. If I try to to a post from my application, I take an ANR and some minutes later a socket time out.
View 2 Replies
View Related
Nov 3, 2009
I downloaded Android SDK Tools, and when I use the tools to download other packages, there is no way to set proxy. How can I download via proxy? thanks!
View 4 Replies
View Related
Jul 17, 2010
I know that android 2.2 also does not support proxy and its really a great problem for people like me who study in schools. I heard that there are custom roms that support proxies (cyanogen rom). There is no proper information on this. I just want to know how good it is for HTC desire.
View 4 Replies
View Related
Oct 15, 2009
I want to to use the browser inside the Android Emulator, and i want to use the proxy settings on my machine, how can i setup this.
Reading the very good manuals of android, they tell me i should start android using the following command
emulator -avd myavd -http-proxy http://168.192.1.2:3300
But still am not able to use the emulator browser. am using the IPAddress for my proxy server.
View 2 Replies
View Related