Mew v1.1.3版本的 MD5 值为:2c97fc89b634adccdf2e096067417e16
以下内容为反编译后的 SampleBC.java 源代码,内容仅作参考
package cl.datacomputer.alejandrob.newgpsjoysticl.sqlite;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import cz.msebera.android.httpclient.Header;
import java.io.UnsupportedEncodingException;
import org.json.JSONException;
import org.json.JSONObject;
public class SampleBC extends BroadcastReceiver {
static int noOfTimes = 0;
@Override
public void onReceive(final Context context, Intent intent) {
noOfTimes++;
Toast.makeText(context, "BC Service Running for " + noOfTimes + " times", 0).show();
AsyncHttpClient client = new AsyncHttpClient();
client.setUserAgent("Mozilla/5.0 (Linux; Android 4.1.1; HTC One X Build/JRO03C) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31");
RequestParams params = new RequestParams();
client.post("http://datacomputer.cl/rest/Sync/getdbrowcount.php", params, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
try {
JSONObject obj = new JSONObject(new String(responseBody, "UTF-8"));
System.out.println(obj.get("count"));
if (obj.getInt("count") != 0) {
Intent intnt = new Intent(context, (Class<?>) MyService.class);
intnt.putExtra("intntdata", "Unsynced Rows Count " + obj.getInt("count"));
context.startService(intnt);
} else {
Toast.makeText(context, "Sync not needed", 0).show();
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (JSONException e2) {
e2.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
if (statusCode == 404) {
Toast.makeText(context, "404", 0).show();
} else if (statusCode == 500) {
Toast.makeText(context, "500", 0).show();
} else {
Toast.makeText(context, "Error occured!", 0).show();
}
}
});
}
}