This commit is contained in:
lixiaopeng
2020-11-27 10:19:52 +08:00
parent c920477081
commit c179018e89

View File

@@ -75,15 +75,8 @@ class MainService : Service() {
private var mLatitude: Double = 0.0
lateinit var serviceApis: IMogoServiceApis
//发送主动上报结果广播给外部
// fun sendCustomResult(result: Boolean) {
// var intent = Intent(customResultAction)
// intent.putExtra("isSuccess", result)
// sendBroadcast(intent)
// }
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.d(TAG, "onStartCommand -----------> ")
//清理多媒体资源和sp策略数据
clearStrategyType(this)
//初始化埋点
@@ -95,7 +88,7 @@ class MainService : Service() {
VoiceController.initVoice()
serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(this) as IMogoServiceApis
speed = serviceApis.getMapServiceApi().getSingletonLocationClient(this).getLastKnowLocation().getSpeed()
Log.d(TAG, "onStartCommand speed = $speed" )
Log.d(TAG, "onStartCommand speed = $speed")
if (intent != null) {
params = intent.getParcelableExtra("params")
params?.let {
@@ -105,18 +98,12 @@ class MainService : Service() {
mLongitude = it.lon
mLatitude = it.lat
Log.d(TAG, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ")
// if (shareType == TANLU_ROAD_CONGESTION || shareType == TANLU_TRAFFIC_CHECK || shareType == TANLU_ROAD_CLOSURE || shareType == TANLU_ROAD_CURRENT
// || shareType == TANLU_ROAD_PONDING || shareType == TANLU_ROAD_ICING || shareType == TANLU_ROAD_HEAVY_FOG
// || shareType == TANLU_ROAD_ACCIDENT || shareType == TANLU_ROAD_WORK
// ) {
// takePhoto(1, false, true)
if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) {
// 如果是策略上报isCustom = false
takeVideo(it.duration)
} else {
takeVideo(it.duration, isCustom = true, id = id)
}
// }
if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) {
// 如果是策略上报isCustom = false
takeVideo(it.duration)
} else {
takeVideo(it.duration, isCustom = true, id = id)
}
}
} else {
Log.e(TAG, "intent == null ")
@@ -210,20 +197,6 @@ class MainService : Service() {
// )
}
// private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {
// Log.e("MainService", "sendMarkerInfoReceiver ------> type = $type ")
// Log.e("MainService", "sendMarkerInfoReceiver ------> fromType = $fromType ")
// Log.e("MainService", "sendMarkerInfoReceiver ------> isCustom = $isCustom ")
// var intent = Intent()
// intent.action = "com.zhidao.roadcondition.marker.info"
// intent.putExtra("type", type)
// intent.putExtra("imageUrl", imageUrl)
// intent.putExtra("lat", lat)
// intent.putExtra("lon", lon)
// intent.putExtra("custom", isCustom)
// intent.putExtra("fromType", fromType)
// sendBroadcast(intent)
// }
/**
* 初始化定位监听
@@ -290,7 +263,7 @@ class MainService : Service() {
}
//获取图片
private fun takePhoto( isInterval: Boolean = false, isCustom: Boolean = false) {
private fun takePhoto(isInterval: Boolean = false, isCustom: Boolean = false) {
Log.d("MainService", "takePhoto -----1----->")
//判断是否授权
// if (isAuthorization(BaseApplication.getAppContext())) {
@@ -388,7 +361,7 @@ class MainService : Service() {
override fun onDestroy() {
super.onDestroy()
unregisterReceiver(mAlarmBroadCast)
unregisterReceiver(mCustomSendBroadCast)
// unregisterReceiver(mCustomSendBroadCast)
CarCorderController.release()
CosCallbackMapController.release()
LatLngStickyEventBus.getInstance().unregister(this)