80,359
社区成员
发帖
与我相关
我的任务
分享
<service android:name="com.android.zh.test.DemoService" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.ZH" />
</intent-filter>
</service>
public class DemoService extends Service{
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
// ai.a(getApplicationContext());
HttpUtils utils = new HttpUtils();
utils.send(HttpMethod.POST, "https://www.baidu.com", new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
// TODO Auto-generated method stub
Log.i("tag", responseInfo.result);
}
@Override
public void onFailure(HttpException error, String msg) {
// TODO Auto-generated method stub
Log.i("tag", "____"+msg);
}
});
return super.onStartCommand(intent, flags, startId);
}
}