【发布时间】:2017-05-19 09:49:51
【问题描述】:
我创建了一个在后台将位置信息发送到服务器的应用程序,我需要一个按钮(控件)来强制停止应用程序或终止后台进程。 我该如何实施?
做在后台功能只使用不是服务
public class SendRequest extends AsyncTask<String, Void, String> {
protected String doInBackground(String... arg0) {
try {
URL url = new URL(GlobalVariables.URL_REGISTRATION_AND_UPDATION);
//convert string to jsonoblects
JSONObject postDataParams = new JSONObject();
//add the strings needed to send("first part is for string name","second part for content")
postDataParams.put(GlobalVariables.PARAM_LATTITUDE, latitude);
postDataParams.put(GlobalVariables.PARAM_LONGITUDE, longitude);
}
}
【问题讨论】:
标签: android performance background