use of com.jamesfchen.map.model.L7 in project spacecraft-android by JamesfChen.
the class ILbsApiServer method mockRequestLocation.
private void mockRequestLocation() {
if (listenerlist == null)
return;
Type type = new TypeToken<List<L7>>() {
}.getType();
List<L7> l7_list = new Gson().fromJson(ResourceUtils.readAssets2String("l7_list.json"), type);
try {
Thread.sleep(1500);
for (L7 l7 : l7_list) {
double lat = l7.appLocation.lat;
double lon = l7.appLocation.lon;
long cid = l7.appCellInfos.get(0).get(0).cid;
long lac = l7.appCellInfos.get(0).get(0).lac;
// startservice 回调(onHandleIntent) 和bindservice回调(onServiceConnected) 都是异步,所以sleep模拟onHandleIntent处理耗时,
// Thread.sleep(500);
final int N = listenerlist.beginBroadcast();
for (int i = 0; i < N; i++) {
ILbsListener l = listenerlist.getBroadcastItem(i);
if (l == null)
continue;
AppCellInfo appCellInfo = new AppCellInfo();
appCellInfo.cid = cid;
appCellInfo.lac = lac;
appCellInfo.isRegistered = true;
appCellInfo.isMockData = true;
AppLocation appLocation = new AppLocation();
appLocation.lat = lat;
appLocation.lon = lon;
appLocation.isMockData = true;
++count;
l.onLocationChanged(appLocation, Collections.singletonList(appCellInfo), count);
}
listenerlist.finishBroadcast();
}
} catch (InterruptedException | RemoteException e) {
e.printStackTrace();
}
}
Aggregations