以下代码来自我的 MANIFEST.XML 文件
以下工作:
<receiver android:name="com.PageP.Alarm>
但是,当我添加进程时它不会触发:
<receiver android:process=":remote" android:name="com.PageP.Alarm>
我有一个断点:
public void onReceive(Context context, Intent intent)
如果没有远程进程,它可以工作,如果我添加远程进程,它就会停止工作。
我错过了什么???
好的,让我发布我的 ASYNC HTTPGET
package com.PageP;
import java.io.IOException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import android.os.AsyncTask;
public class GrabURL extends AsyncTask<String, Void, Void> {
private HttpClient Client = new DefaultHttpClient();
private String content;
private String Error = null;
private String url = null;
protected void onPreExecute() {
// Dialog.setMessage("Downloading source..");
// Dialog.show();
}
protected Void doInBackground(String... urls) {
url = urls[0];
try {
HttpGet httpget = new HttpGet(urls[0]);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
content = Client.execute(httpget, responseHandler);
} catch (ClientProtocolException e) {
Error = e.getMessage();
cancel(true);
} catch (IOException e) {
Error = e.getMessage();
cancel(true);
}
return null;
}
protected void onPostExecute(Void unused) {
Login.GotURL(content, url);
Client = null;
}
}
然后我称之为
public static void Ping(String Args) {
final GrabURL wget = new GrabURL();
String url = "";
url = MyAuth("PING")+ Args;
wget.execute(PPURL+url);
}
当我的警报触发时,我希望它保持清醒,以便在我解码返回的 HTML 的另一端接收数据。当 Android 进入睡眠模式时,我遇到了问题,它不能可靠地接收 HTML 返回的数据。