HttpClient模块的HttpGet和HttpPost及Connection to refuse解决
Http定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DELETE,分别对应查,改,增,删四种操作。Android中最常用的是HttpGet和HttpPost
无论是使用HttpGet,还是使用HttpPost,都必须通过如下3步来访问HTTP资源。
1.创建HttpGet或HttpPost对象,将要请求的URL通过构造方法传入HttpGet或HttpPost对象。
2.使用DefaultHttpClient类的execute方法发送HTTP GET或HTTP POST请求,并返回HttpResponse对象。
3.通过HttpResponse接口的getEntity方法返回响应信息,并进行相应的处理。、
HttpGet方法
public String doGet()
{ String uriAPI = "http://192.168.1.1/index.php/?name=jason&password=1234"; String result= "";
// 创建HttpGet对象,将要请求的URL通过构造方法传入,参数附在url的后面。 HttpGet httpRequst = new HttpGet(uriAPI); try {
// 使用DefaultHttpClient类的execute方法发送HTTP GET请求,并返回HttpResponse对象。 HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequst);//其中HttpGet是HttpUriRequst的子类 if(httpResponse.getStatusLine().getStatusCode() == 200) { HttpEntity httpEntity = httpResponse.getEntity(); result = EntityUtils.toString(httpEntity);//取出应答字符串 } else httpRequst.abort(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result;
}
HttpPost方法
如果使用HttpPost方法提交HTTP POST请求,则需要使用HttpPost类的setEntity方法设置请求参数。参数则必须用NameValuePair[]数组存储。
public String doPost()
{ String uriAPI = "http://192.168.1.1/index.php";//Post方式没有参数在这里 String result = ""; HttpPost httpRequst = new HttpPost(uriAPI);//创建HttpPost对象 List <NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("username", "jason")); params.add(new BasicNameValuePair("password", "1234")); try { httpRequst.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8)); HttpResponse httpResponse = new DefaultHttpClient().execute(httpRequst); if(httpResponse.getStatusLine().getStatusCode() == 200) { HttpEntity httpEntity = httpResponse.getEntity(); result = EntityUtils.toString(httpEntity);//取出应答字符串 } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); result = e.getMessage().toString(); } return result;
}
实例:用HttpPost方法与php进行登陆交互
原理:android客户端通过HttpPost发送用户名和密码到服务器端,服务器端收到数据,连接到数据库查询,如果匹配正确,就输出login succeed返回给客户端
服务器端:
在mysql中新件testConnect数据库,创建users表
新建php项目,建立文件login.php
<?php
$dbhost="localhost:3306";//数据库的地址:端口号
$dbuser="root";//用户名
$dbpass="root";//密码
$dbname="testConnect";//数据库名称
$cn=mysql_connect($dbhost,$dbuser,$dbpass) or die("connect error");
@mysql_select_db($dbname) or die("db error");
mysql_query("set name 'UTF-8'");$username=$_POST['username'];
$sql="select * from users where username='$username'";
$query=mysql_query($sql);
$rs=mysql_fetch_array($query);
if(is_array($rs)){if($_POST['pwd']==$rs['password']){echo "login succeed";}else{echo "login error";}
}
?>
客户端:
登陆界面布局
MainActivity.java代码:
package com.example.foodie;import java.util.ArrayList;
import java.util.List;import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;public class MainActivity extends ActionBarActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.fragment_main);Button loginButton = (Button)findViewById(R.id.login);loginButton.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View arg0) {// TODO Auto-generated method stubEditText usernameText = (EditText)findViewById(R.id.username),passwordText = (EditText)findViewById(R.id.password);LoginHandle loginHandle =new LoginHandle(usernameText,passwordText);Thread loginThread = new Thread(loginHandle);loginThread.start();}});}
}class LoginHandle implements Runnable{EditText usernameText,passwordText;public LoginHandle(EditText username,EditText password){this.usernameText = username;this.passwordText = password;}@Overridepublic void run(){String username = usernameText.getText().toString(),password = passwordText.getText().toString();
// 连接到服务器的地址String connectURL = "http://192.168.1.104/mystudy/ConnectAndroid/login.php";
// 填入用户名密码和连接地址String result = "";
// 发送post请求HttpPost httpPost = new HttpPost(connectURL);
// Post运作传送变数必须用NameValuePair[]阵列存储List<BasicNameValuePair>params = new ArrayList<BasicNameValuePair>();params.add(new BasicNameValuePair("username", username));params.add(new BasicNameValuePair("pwd", password));
// 发出Http请求try{httpPost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
// 取回Http应答DefaultHttpClient client = new DefaultHttpClient();HttpResponse httpResponse = client.execute(httpPost);
// 若状态码为200则请求成功,取得返回的数据if(httpResponse.getStatusLine().getStatusCode() == 200){
// 取出字符串result = EntityUtils.toString(httpResponse.getEntity());}}catch(Exception e){e.printStackTrace();}if(result.equals("login succeed")){System.out.println("登陆成功,可以回家睡觉了少年!");}else {System.out.println("你是猪吗?");}}
}
关于 org.apache.http.conn.HttpHostConnectException: Connection to refused错误的解决办法
增加网络访问权限:
找到 AndroidManifest.xml 文件。在application标签后面加上 <uses-permission android:name="android.permission.INTERNET"/>
检查ip地址:
启动的android模拟器吧自己也当成127.0.0.1和localhost,如果使用了localhost或者127.0.0.1则会被拒绝访问,把ip地址改成实际地址,如192.168.1.104
Android应用程序权限清单:
<span style="font-family:SimSun;font-size:18px;">android.permission.ACCESS_CHECKIN_PROPERTIES :
Allows read/write access to the “properties” table in the checkin database, to change values that get uploaded.
允许以read/write访问检入数据库(checkin database?)的"properties"表,并且可以更改、更新数据库。 android.permission.ACCESS_COARSE_LOCATION :
Allows an application to access coarse(e.g, Cell-ID, WiFi) location.
允许一个应用程序通过访问CellID和WiFi热点等方式获取粗略的本地位置。 android.permission.ACCESS_FINE_LOCATION :
Allows an application to access fine(e.g, GPS) location.
允许一个应用程序通过访问GPS等方式获取较精确的本地位置。 android.permission.ACCESS_LOCATION_EXTRA_COMMANDS :
Allows an application to access extra location provider commands.
允许一个应用程序访问(使用)额外的本地位置服务提供者。 android.permission.ACCESS_MOCK_LOCATION :
Allows an application to access mock location providers for testing.
允许一个应用程序访问(创建)模拟的位置服务提供者用于测试。 android.permission.ACCESS_NETWORK_STATE :
Allows applications to access information about networks.
允许应用程序访问(获取)网络信息。 android.permission.ACCESS_SURFACE_FLINGER :
Allows an application to use SurfaceFlinger’s low level features.
允许一个应用程序使用SurfaceFlinger的底层属性。(什么是SurfaceFlinger?) android.permission.ACCESS_WIFI_STATE :
Allows applications to access information about Wi-Fi networks.
允许应用程序获取Wi-Fi网络的信息)。 android.permission.ACCOUNT_MANAGER :
Allows an applications to call into AccountAuthenticators.
允许一个应用程序启动账户认证。 android.permission.AUTHERTICATE_ACCOUTS :
Allows an applicatons to act as an AccoutAuterticator for the AccoutManger.
允许一个应用程序充当账户认证管理者。 android.permission.BATTERY_STATS :
Allows an application to collect battery statistics.
允许一个应用程序获取电池使用的统计信息(剩余电量、电池的耗电情况(各主要应用程序耗电占总耗电的百分比等)等)。 android.permission.BIND_APPWIGET :
Allows an application to tell the AppWiget service which application can access AppWiget data.
允许一个应用程序告知AppWiget服务:我(当前应用程序)可以访问AppWiget数据。 android.permission.BIND_DEVICE_ADMIN :
Must be required by device administration receiver, to ensure that only the system can interact with it.
设备管理服务必须拥有的权限,确保只有系统可以通过设备管理服务与设备进行互动(访问设备,数据交互)。 android.permission.BIND_INPUT_METHOD :
Must be required by an InputMethodService, to ensure that only the system can bind to it.
输入法服务(InputMethodService)必须拥有的权限,确保只有系统可以绑定之。 android.permission.BIND_WALLPAPER :
Must be required by a WallpaperService, to ensure that only the system can bind to it.
桌面服务(WallpaperService)必须拥有的权限,确保只有系统才可以绑定之. android.permission.BLUETOOTH :
Allows applications to connect to paired buletooth devices.
允许应用程序连接到已配对的蓝牙设备(远端蓝牙,非本机蓝牙)。 android.permission.BULETOOTH_ADMIN :
Allows applications to discover an pair bluetooth devices.
允许应用程序搜索并且配对蓝牙设备。 android.permission.BRICK :
Required to be able to disable the device (very dangrous!).
禁用设备必须拥有的权限(危险,慎用!)。 android.permission.BROADCAST_PACKAGE_REMOVED :
Allows an application to boradcast a notification that an application package has been removed.
允许一个应用程序广播“一个(不是同一个)应用程序包已经被移除”的通告。(指一个应用程序已被卸装的通告?) android.permission.BROADCAST_SMS :
Allows an application to broadcast an SMS receipt notification.
允许一个应用程序广播一个短信回执(如:帅哥,你有一条新的短消息!)的通告。 android.permission.BROADCAST_STICKY :
Allows an application to broadcast sticky intents.
允许一个应用程序广播常用(sticky?) intents. android.permission.WAP_PUSH :
Allows an application to broadcast a WAP PUSH receipt notification.
允许一个应用程序广播WAP PUSH回执通告。
说明:WAP-PUSH,WAP推送短信,是一种特殊格式的短信。WAP-PUSH可以将某一站点或某一业务的链接通过短息发送到支持WAP的设备,WAP PUSH实现了短信和WAP业务的结合。 android.permission.CALL_PHONE :
Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.
允许应用程序不经过用户拨号界面而直接拨号。 android.permission.CALL_PRIVILEGED :
Allows an application to call any phone number, including emergency numbers, without going througth the Dialer user interface for confirm the call being palced.
允许应用程序不经过用户拨号界面而拨打任意号码(包括紧急号码)。(紧急号码是指哪些?) android.permission.CAMERA :
Required to be able to access the camera device.
访问摄像头设备必须具备的权限。 android.permission.CHANGE_COMPONENT_ENABLED_STATE :
Allows an application to change whether an application component (other than its own) is enabled or not.
允许一个应用程序改变另一个应用程序组件的启用状态(禁用或启用)。 android.permission.CHANGE_NETWORK_STATE :
Allows applications to change network connecitity state.
允许应用程序更改网络连接状态。 android.permission.CHANGE_WIFIMULTICAST_STATE :
Allows applications to enter Wi-Fi Multicast mode.
允许应用程序进入Wi-Fi Multicast 模式。
说明:Multicast,多重广播,网络中的一个节点发出的信息被多个节点接收。 android.permission.CHANGE_WIFI_STATE :
Allows applications to change Wi-Fi connectivity state.
允许应用程序更改Wi-Fi连接状态。 android.permission.CLEAR_APP_CACHE :
Allows an application to clear the caches of all installed application on the device.
允许一个应用程序清理所有已安装程序的设备缓冲区 (是安装的时候使用的缓冲区,还是运行时候的缓冲区?) android.permission.CLEAR_APP_USER_DATA :
Allows an application to clear user data.
允许一个应用程序清理用户数据。 android.perimmision.CONTROL_LOCATION_UPDATES :
Allows enabling/disabling location update notification from the radio.
允许启用/禁用位置更新的提示信息。(from the radio? 通过电波获得的位置更新信息?) android.permission.DELETE_CACHE_FILES :
Allows an application to delete cache files.
允许一个应用程序删除cache文件。 android.permission.DLEETE.PACKAGES :
Allows an application to delete packages.
允许一个应用程序删除packages(apk安装包?还是所有类型的压缩包?) android.permission.DEVICE_POWER :
Allows low-level access to power management.
允许访问底层的电源管理。 android.permission.DIAGNOSTIC :
Allows application to RW to diagnostic resources.
允许应用程序读写诊断资源(diagnostic resources)。(什么事diagnostic resources?诊断信息,log?) android.permission.DISABLE_KEYGUARD :
Allows aplications to disable the keyguard.
允许应程序禁用键盘锁。 android.permission.DUMP :
Allows an application to retrieve state dump information from system services.
允许一个应用程序从系统服务中抓取(检索)状态转储信息。(什么是state dump?将数据从一个设备转存到另外一个设备?) android.permission.EXPAND_STATUS_BAR :
Allows an applicaton to expand or collapse the status bar.
允许一个应用程序扩张或收缩状态栏。 android.permission.FACTORY_TEST :
Run as an manufacturer test application, running as the root user.
允许像厂家测试程序那样以root用户权限运行应用程序。 android.permission.FLSHLIGHT :
Allows access to the flashlight.
允许访问闪光信号灯。 android.permission.FORCE_BACK :
Allows an application to force a BACK operation on whatever is the top activity.
允许一个应用程序在activity上强制执行一个回退操作,无论这个activity是否是顶层的activity。 android.permission.GET_ACCOUNTS :
Allows access to the list of accouts in the Accounts Service.
允许访问账号服务的账号列表。 android.permission.GET_PACKAGE_SIZE :
Allows an application to find out the space used by any package.
允许应用程序获得任何package占用的存储空间。 android.permission.GET_TASKS :
Allows an appllication to get information about the currently or recently running tasks: a thumbnail representation of the tasks ,what activities are running in it, etc.
允许一个应用程序获得的当前或最近运行的任务信息:像在任务中运行了哪些activitys等一些简短信息。 android.permission.GLBOAL_SEARCH :
This permission can be used on content providers to allow the global search system to access their data.
拥有该权限的content providers将允许全局搜索系统访问其数据。 android.permission.HARDWARE_TEST :
Allows access to hardware peripherals.
允许访问外设。 android.permission.INJECT_EVENTS :
Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.
允许一个应用程序向事件流(事件队列)注入用户事件(keys,touch,tarckball),并且将其传递给窗口。 android.permission.INSTALL_LOCATION_PROVIDER :
Allows an application to install a locaton provider int the location Manager.
允许应用程序程序安装一个位置服务到位置管理器。 androd.permission.INSTALL_PCAKAGES :
Allows an application to install packages.
允许一个应用程序安装packages。(用于版本升级的?) android.permission.INTERNAL_SYSTEM_WINDOW :
Allows an application to open windows that are for use by parts of the system user interface.
允许一个应用程序打开系统用户界面中的窗口。 android.permission.INTERNET :
Allows application to open networkd sockets.
允许应用程序打开网络套接字(sockets)。 android.permission.KILL_BACKGROUND_PROCESSES :
Allows an application to call killBackgroundProcesses(String).
允许应用程序调用killBackgroundProcesses(String)方法。 android.permission.MANAGE_ACCOUNTS :
Allows an application to manage the list of accouts in the AccountManager.
允许应用程序管理AccountManager中的账户列表。 android.permission.MANAGE_APP_TOKENS :
Allows an application to manage (create, destroy, Z-order) application tokens in the window manager.
允许一个应用程序管理(创建、销毁、Z-order)在窗口管理器中的应用程序图标。 android.permission.MASTER_CLEAR:
none.
没任何描述。 android.permisson.MODIFY_AUDIO_SETTINGS :
Allows an application to modify global audio settings.
允许一个应用程序更改全局音频设置。 android.permission.MODIFY_PHONE_STATE :
Allows modification of the telephony state – power on, mmi, etc.
允许修改电话(手机?)状态——上电,人机界面(mmi,Man Machine Interface)等。 android.permission.MOUNT_FORMAT_FILESYSTEMS :
Allows formatting file sysytems for removable storage.
允许格式化移动存储设备。 android.permission.MOUNT_UNMOUNT_FILESYSYTEMS :
Allows mounting and unmounting the file sysytems for removable storage.
允许加载或卸载移动存储设备。 android.permission.FERSISTENT_ACTIVITY :
Allows an application to make its activities persistent.
允许一个应程序设置其activities具有持久性(persistent activities是什么样的activites?)。 android.permission.PROCESS_OUTGOING_CALLS :
Allows an application to monitor, modify, or abort outgoing calls.
允许应用程序监视、修改、忽略拨出的电话(拨号)。 android.permission.READ_CALENDAR :
Allows an application to read the user’s calendar data.
允许一个应用程序读取用户日历数据。 android.permission.READ_CONTACTS :
Allows an apllication to read the user’s contacts data.
允许一个应用程序读取用户联系人列表。 android.permission.READ_FRAME_BUFFER :
Allows an application to take screen shots and more generally get access to the frame buffer data.
允许一个应用程序通过访问帧缓冲区(一般一屏就是一帧)获取屏幕截图等帧数据。 android.permission.READ_HISTORY_BOOKMARKS :
Allows an application to read (but not write) the user’s browsing history and bookmarks.
允许一个应用程序读取浏览器的历史记录和书签。 android.permission.READ_INPUT_STATE :
Allows an application to retrieve the current state of keys and switches.
允许一个应用程序获取当前keys和switches的状态(keys、switchs都是输入设备)。 android.permission.READ_LOGS :
Allows an application to read the low-level system log files.
允许一个应用程序读取底层系统的log文件。 android.permission.READ_OWNER_DATA :
Allows an application to read the owner’s data.
允许一个应用程序读取所有者的数据。(手机的owner?) android.permission.READ_PHONE_STATE :
Allows read only access to phone state.
允许读取(不可写)手机状态。 android.permission.READ_SMS :
Allows an application to read SMS messages.
允许一个应用程序读取手机短消息。 android.permission.READ_SYNC_SETTING :
Allows applications to read the sync setting.
允许应用程序读取同步设置 android.permission.READ_SYNC_STATS :
Allows applications to read sync stats.
允许一个应用程序读取同步状态。 android.permission.REBOOT :
Required to be able to reboot the device.
重启设备必须具有的权限。 android.permission.RECEIVE_BOOT_COMPLETED :
Allows an application to receive the ACTION_BOOT_COMPLETED that is boradcast after the sysytem finishes booting.
允许应用程序获取系统完全启动之后的ACTION_BOOT_COMPLETED广播。 android.permission.RECEIVE_MMS :
Allows an application to monitor incoming MMS messages, to record or perform processing on them.
允许一个应用程序监控收到的彩信(MMS),记录或处理之。 android.permission.RECEIVE_SMS :
Allows an application to monitor incoming SMS messages, to record or perform processing on them.
允许一个应用程序监控收到的短信(SMS),记录或处理之。 android.permission.RECEIVE_WAP_PUSH :
Allows an application to monitor incoming WAP push messages.
允许一个应用程序监测接受的WAP-PSUH消息。 android.permission.RECORD_AUDIO :
Allows an application to record audio.
允许一个应用程序录音。 android.permission.REORERD_TASKS :
Allows an application to change the Z-order of tasks.
允许一个应用程序改变任务的Z-order(类似于优先级?)。 android.permission.RESTART_PACKAGES :
This constant is deprecated. The restartPackage(String) API is no longer supported.
这个常量已不再使用,restartPackage这个API函数不再有效。 android.permission.SEND_SMS :
Allows an application to send SMS messages.
允许应用程序发送短消息(SMS)。 android.permission.SET_ACTIVITY_WATHCER :
Allows an application to watch and control how activities are started globally in system.
允许一个应用程序在全局系统中监控activities是如何被启动的。 android.permission.SET_ALWAYS_FINISH :
Allows an application to control whether activities are immediately finished when put in the background.
允许应用程序无论activies是否刚刚结束,都将应用程序置于后台运行。(强制结束activies,置应用程序于后台运行?) android.permission.SET_ANIMATION_SCALE :
Modify the global animation scaling factor.
修改全局动画缩放比例。 android.permission.SET_DEBUG_APP :
Configure an application for debugging.
为调试配置一个应用程序。 android.permission.SET_ORIENTATION :
Allows low-level access to setting the orientation (actually rotation) of the screen.
允许设置屏幕方向(实际上就是旋转屏幕)。 android.permission.SET_PREFERRED_APPLICATIONS :
This constant is deprecated, No longer useful, see addPackageToPreferred(String)for details.
这个常量已经无效了。 android.permission.SET_PROCESS_LIMIT :
Allows application to set the maximum number of (not needed) application processes that can be runing.
允许应用程序设置最大可用进程数(不是必须的)。 android.permission.SET_TIME :
Allows applications to set the system time.
允许应用程序设置系统时间。 android.permission.SET_TIME_ZONE :
Allows applications to set the system time zone.
允许应用程序设置系统时区。 android.permission.SET_WALLPAPER :
Allows applications to set the wallpaper.
允许应用程序设置桌面。 android.permission.SET_WALLPAPER_HINTS :
Allows application to set wallpaper hints.
允许应用程序设置桌面提示。(wallpaper hints 是什么东东?) android.permission.SINGAL_PERSISTENT_PROCESSES :
Allows an application to request that a signal be sent to all persistent processes.
允许应用程序请求一个发送给所有持续进程的信号(signal)。(persistent processes 是什么样的进程?) android.permission.STATUS_BAR :
Allows an application to open, close, or disable the status bar and its icons.
允许一个应用程序打开、关闭、禁用状态栏和状态栏图标。 android.permission.SUBSCRIBED_FEEDS_READ :
Allows an application to allow access the subscribed feeds ContentProvider.
允许一个应用程序访问订阅RSS feeds的ContentProvider。 android.permission.SUBSRIBED_FEEDS_WRITE :
None.
没有任何描述。 android.permission.SYSYTEM_ALERT_WINDOW :
Allows an application to open windows using the type TYPE_SYSTEM_ALERT, show on top of all other applications.
允许应用程序打开一个TYPE_SYSTEM_ALERT类型的系统警告(提示)窗口, 并将其置于顶层显示。 android.permission.UPDATE_DEVICE_STATS :
Allows an application to update device statistics.
允许应用程序更新设备统计信息。 android.permission.USE_CREDENTIALS :
Allows an application to request authtokens from the AccountManager.
允许一个应用程序向AccountManager申请授权标记。 android.permission.VIBRATE :
Allows access to the vibrator.
允许访问振动器。 android.permission.WAKE_LOCK :
Allows using PowerManager WakeLocks to keep processor from sleeping or screen from dimming.
允许使用PowerManager WakeLocks,避免处理器进入休眠,或屏幕变暗。 android.permission.WRITE_APN_SETTINGS :
Allows applications to write the apn settings.
允许应用程序设置APN。
说明:APN(Acess Point Name)即“接入点名称”,用来标识GPRS的业务种类,目前分为两大类: CMWAP(通过GPRS访问WAP业务)、CMNET(除了WAP以外的服务目前都是CMNET,比如连接因特网等)。 android.permission.WRITE_CALENDAR :
Allows an application to write (but not read) the user’s calendar data.
允许应用程序只写用户日历数据。 android.permission.WRITE_CONTACTS :
Allows an application to write (but not read) the user’s contacts data.
允许应用程序只写用户联系人数据。 android.permission.WRITE_EXTERNAL_STORAGE :
Allows an application to write to external storage.
允许应用程序写数据到外部存储设备(主要是SD卡)。 android.permission.WRITE_GSERVICES :
Allows an application to modify the Google service map.
允许应用程序修改google地图服务。 android.permission.WRITE_HISTORY_BOOKMARKS :
Allows an application to write (but not read) the user’s browsing history and bookmarks.
允许一个应用程序写数据到用户浏览器历史记录和书签。 android.permission.WRITE_OWNER_DATA :
Allows an application to write (but not read) the owner’s data.
允许一个应用程序写入(填入)所有者(手机所有者?)的信息。 android.permission.WRITE_SECURE_SETTINGS :
Allows an application to read or write the secure system settings.
允许一个应用程序读写系统安全设置。 android.permission.WRITE_SETTINGS :
Allows an application to read or write the system setting.
允许一个应用程序读写系统设置。 android.permission.WRITE_SMS :
Allows an application to write SMS messages.
允许一个应用程书写短消息。 android.permisson.WRITE_SYNC_SETTING :
Allows applications to write the sync setting.
允许应用程序更改同步设置</span>
参考文档:http://blog.csdn.net/caesardadi/article/details/8621595
http://blog.csdn.net/rznice/article/details/39854785
http://www.360doc.com/content/13/0817/15/2569758_307820941.shtml
HttpClient模块的HttpGet和HttpPost及Connection to refuse解决相关推荐
- android网络编程——HttpGet、HttpPost比较
在Android SDK中提供了Apache HttpClient(org.apache.http.*)模块.在这个模块中涉及到两个重要的类:HttpGet和HttpPost,他们有共性也有不同. H ...
- HttpGet与HttpPost添加参数
HttpGet与HttpPost添加参数 HttpGet添加参数 HttpGet是没有办法添加参数的,但是有时候访问的URI也包含参数,且参数较多,这时候,需要借助别的方法来添加参数. 1.直接使用字 ...
- HTTPGet 与HTTPPost的区别
HTTPGet 与HTTPPost的区别 今天在老师工作室做项目的时候,突然看到一个页面用了2种不同的传值类型,突然有了兴趣,想弄明白本质的区别,虽然以前用的知道2种的用法,但是还是云里雾里的,下面是 ...
- MySQL 之Navicat Premium 12安装使用、pymysql模块使用、sql注入问题的产生与解决
阅读目录 一.Navicat Premium 12简介与使用: 二.pymysql模块的使用: 查: 增删改 三.sql注入问题产生与解决方法: 本文内容提要: Navicat Premium 12 ...
- ssh登陆connection refused的解决办法
http://zhidao.baidu.com/share/17f3e1e6700c559b6036f6e49d82fd5c.html 资源介绍: SSH的安装及登录提示:connection ref ...
- VS2013模块对于SAFESEH映像是不安全的解决方法
VS2013模块对于SAFESEH映像是不安全的解决方法 参考文章: (1)VS2013模块对于SAFESEH映像是不安全的解决方法 (2)https://www.cnblogs.com/fengxw ...
- linux telnet 127.0.0.1 不通,Linux 出现telnet: 127.0.0.1: Connection refused错误解决办法
Linux 出现telnet: 127.0.0.1: Connection refused错误解决办法 Linux 出现telnet: connect to address 127.0.0.1: Co ...
- 程序执行报错Missing Connection or ConnectionString 解决方法
程序执行报错Missing Connection or ConnectionString 解决方法 参考文章: (1)程序执行报错Missing Connection or ConnectionStr ...
- 刀塔2国服服务器都未响应,电脑中玩dota2卡死出现无响应蓝屏红字warning:connection problem如何解决...
dota2是款众多玩家都非常青睐的一款网络游戏,可是在电脑中玩的时候,想必很多玩家都会碰到这样的现象,比如玩odta2选人或者进画面会卡住不动或者出现无响应的情况,或者右上角显示红字warning:c ...
最新文章
- DevOps之旅:运维人员阅读源代码的实用技巧
- 【SmartJob】【隔离】每天定时掉线问题解决:隔离定期重启脚本更新
- 【DB2】NVL2函数
- iOS 11: CORE ML—浅析
- hive-内置函数(常用内置函数汇总)
- Mysql -- 外键的变种 三种关系
- guid主键 oracle_关于ORACLE的GUID主键生成
- mapbox绘制航线图
- ASCII 码对照表
- 【见闻录系列】浅谈搜索系统与推荐系统的一点区别
- html中加入计时器,javascript怎么做计时器?
- 单词记忆系统-项目需求分析
- [Ctsc2010]珠宝商 SAM+点分治+根号分治
- 在浏览器中打开shell,连接linux
- 一大波无门槛优惠券来袭(仅限300张)
- windows下C++实现Unicode和ASCII编码的互转
- CSS面试题整理汇总
- 虚拟机.linux.pgf90
- Excel多个工作表合并,如何去除每个工作表中的表头,只保留一个表头
- Octopus FS 论文学习索引