android如何将intent服务与asyncktask结合使用
我想从我的android应用程序IntentService(onHandleIntent方法)调用一个web服务,但正如他们所说的,遵循这个url是不安全的 从OnHandleContent调用web服务并获取web服务返回的数据以使用它的最佳方法是什么android如何将intent服务与asyncktask结合使用,android,android-intent,Android,Android Intent,我想从我的android应用程序IntentService(onHandleIntent方法)调用一个web服务,但正如他们所说的,遵循这个url是不安全的 从OnHandleContent调用web服务并获取web服务返回的数据以使用它的最佳方法是什么 @Override protected void onHandleIntent(Intent intent) { try{ getTransactions get=new getTransact
@Override
protected void onHandleIntent(Intent intent) {
try{
getTransactions get=new getTransactions("0");
get.execute(d1,d2);
//Here in on postExecute i need to do something with the results
}
}
catch(Exception e)
{
writeToFile("Exception" + e + "\n");
}
MyReceiver.completeWakefulIntent(intent);
}
“我想从我的android应用程序IntentService调用web服务”-所以就这么做吧。不需要
异步任务
,因为onHandleIntent()
已经异步运行了。好的,那么如何使用web服务返回的数据呢?在这种情况下,“onPostExecute”方法有什么相似之处?一个选项是将结果广播回您的活动中,或在您需要的任何地方。