正在查看: 管控平台 v5.2.3.0. 应用的 BuryLocationReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 BuryLocationReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.mdmservice.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.search.core.SearchResult;
import com.baidu.mapapi.search.geocode.GeoCodeResult;
import com.baidu.mapapi.search.geocode.GeoCoder;
import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener;
import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption;
import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult;
import com.baidu.mapapi.utils.CoordinateConverter;
import com.iflytek.mdmcommon.LogUtil;
public class BuryLocationReceiver extends BroadcastReceiver {
private Context f357a;
LocationManager f358b;
double f359c;
double d = -1.0d;
private GeoCoder e = GeoCoder.newInstance();
private com.iflytek.mdmservice.l.a f = new com.iflytek.mdmservice.l.a();
private OnGetGeoCoderResultListener g = new a();
private LocationListener h = new b(this);
class a implements OnGetGeoCoderResultListener {
a() {
}
public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {
if (geoCodeResult == null || ((SearchResult) geoCodeResult).error != SearchResult.ERRORNO.NO_ERROR) {
LogUtil.z("onGetGeoCodeResult.没有检索到结果");
}
LogUtil.z("onGetGeoCodeResult.获取地理编码结果");
}
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) {
if (reverseGeoCodeResult == null || ((SearchResult) reverseGeoCodeResult).error != SearchResult.ERRORNO.NO_ERROR) {
LogUtil.z("onGetReverseGeoCodeResult.没有找到检索结果");
BuryLocationReceiver.this.b(null);
return;
}
LogUtil.z("逆编码地址:" + reverseGeoCodeResult.getAddress());
LogUtil.z("onGetReverseGeoCodeResult.获取反向地理编码结果");
BuryLocationReceiver.this.b(reverseGeoCodeResult.getAddress());
}
}
class b implements LocationListener {
b(BuryLocationReceiver buryLocationReceiver) {
}
@Override
public void onLocationChanged(Location location) {
LogUtil.z("LocationListener.onLocationChanged(Location)");
}
@Override
public void onProviderDisabled(String str) {
LogUtil.z("LocationListener.onProviderDisabled(String)");
}
@Override
public void onProviderEnabled(String str) {
LogUtil.z("LocationListener.onProviderEnabled(String)");
}
@Override
public void onStatusChanged(String str, int i, Bundle bundle) {
LogUtil.z("LocationListener.onStatusChanged(String, int, Bundle)");
}
}
public void b(String str) {
this.f.k(this.f359c, this.d, str);
}
private void c() {
CoordinateConverter coordinateConverter = new CoordinateConverter();
coordinateConverter.from(CoordinateConverter.CoordType.GPS);
LatLng latLng = new LatLng(this.d, this.f359c);
LogUtil.z("换算前:经度:" + latLng.longitude + ", 维度:" + latLng.latitude);
coordinateConverter.coord(latLng);
LatLng convert = coordinateConverter.convert();
LogUtil.z("换算后:经度:" + convert.longitude + ", 维度:" + convert.latitude);
ReverseGeoCodeOption reverseGeoCodeOption = new ReverseGeoCodeOption();
reverseGeoCodeOption.location(convert);
this.e.reverseGeoCode(reverseGeoCodeOption);
}
private void d() {
try {
this.f358b = (LocationManager) this.f357a.getSystemService("location");
Criteria criteria = new Criteria();
criteria.setAccuracy(2);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(false);
criteria.setPowerRequirement(1);
String bestProvider = this.f358b.getBestProvider(criteria, true);
this.f358b.requestLocationUpdates(bestProvider, 1000L, 0.0f, this.h);
Location lastKnownLocation = this.f358b.getLastKnownLocation(bestProvider);
if (lastKnownLocation != null) {
this.f359c = lastKnownLocation.getLongitude();
this.d = lastKnownLocation.getLatitude();
LogUtil.z("显示地理位置(经度:" + lastKnownLocation.getLongitude() + ", 维度:" + lastKnownLocation.getLatitude() + ")");
}
} catch (SecurityException e) {
LogUtil.e(e.getMessage());
}
}
@Override
public void onReceive(Context context, Intent intent) {
LogUtil.zz("BuryLocationReceiver onReceive");
this.f357a = context;
this.e.setOnGetGeoCodeResultListener(this.g);
d();
if (this.f359c == -1.0d || this.d == -1.0d) {
LogUtil.z("GPS Closed!!!");
} else {
c();
}
}
}