context.startService() 调用是否保证被服务按照它们发送的顺序获取?
在活动中考虑:
Intent intent;
intent = new Intent(MyIntents.ADD_BATCH_ACTION);
intent.putExtra(MyIntents.BATCH_ACTION_NAME, "Bake donuts");
startService(intent);
intent = new Intent(MyIntents.ADD_BATCH_ACTION);
intent.putExtra(MyIntents.BATCH_ACTION_NAME, "Make a coffee");
startService(intent);
intent = new Intent(MyIntents.ADD_BATCH_ACTION);
intent.putExtra(MyIntents.BATCH_ACTION_NAME, "Fetch coffee and donut to room 12");
startService(intent);
startService(new Intent(MyIntents.FLUSH_ADDED_ACTIONS));
有些动作可能有很多共同的工作,如果我确定它们是成批执行的,我可以优化服务。
我可以假设 service onStartCommand 将以相同的顺序执行吗?
问候,托梅克