添加上报频率设置

This commit is contained in:
tongchenfei
2020-11-25 17:44:33 +08:00
parent 431f5f3ca9
commit 87498bf5ff
5 changed files with 88 additions and 5 deletions

View File

@@ -1,6 +1,9 @@
package com.mogo.module.service.location;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
@@ -43,7 +46,7 @@ public class MogoRTKLocation {
super.handleMessage(msg);
if (msg.what == MSG_DATA_CHANGED) {
sendLocationData();
mHandler.sendEmptyMessageDelayed(MSG_DATA_CHANGED, MSG_DATA_INTERNAL);
mHandler.sendEmptyMessageDelayed(MSG_DATA_CHANGED, uploadDelay);
}
}
};
@@ -89,6 +92,10 @@ public class MogoRTKLocation {
} else {
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
}
// 注册修改上报间隔的广播, 临时使用后面可直接干掉发送广播的地方在EntranceFragment
IntentFilter filter = new IntentFilter("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
AbsMogoApplication.getApp().registerReceiver(fixUploadDelayReceiver, filter);
}
private Criteria getCriteria() {
@@ -142,4 +149,15 @@ public class MogoRTKLocation {
Logger.d(TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null");
}
}
private long uploadDelay = MSG_DATA_INTERNAL;
private FixUploadDelayReceiver fixUploadDelayReceiver = new FixUploadDelayReceiver();
private class FixUploadDelayReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
uploadDelay = intent.getIntExtra("fixTime", 0);
}
}
}