【发布时间】:2014-02-26 00:24:18
【问题描述】:
我们正在从 SQLite db 加载大量数据,并使用 IntentService。
加载完成时,有一个活动从 IntentService 接收广播。在 IntentService 完成之前尝试启动 Activity 时,onHandler(Intent intent) 方法会被多次调用。
Intent Service 在应用程序启动时启动。
public void onCreate(){
super.onCreate();
startService(new Intent(this, QuoteService.class);
}
意图服务
@Override
protected void onHandleIntent(Intent intent) {
Log.v("Intent","Handler Intent");
DataAccessObject dof=new DataAccessObject(getApplicationContext());
........
`........` *// data loaded from Data Access Object*
sendPersonListBroadcast();
*// method which sends Broadcast to Activity*
【问题讨论】:
-
由于内存限制,Android 是否可能正在杀死和恢复您的服务?
-
服务中的 onStartCommand(...) 是否被调用?服务中的 onStartCommand 或 onCreate 是否也被多次调用?
标签: android