From 96f2b56c103c53b17cf946d2c733d4cb03d2f39d Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 29 一月 2024 15:16:28 +0800
Subject: [PATCH] 2024年01月29日15:16:23
---
app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java | 66 +-------------------------------
1 files changed, 3 insertions(+), 63 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
index dfef1b7..e276732 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
@@ -44,6 +44,7 @@
import com.hdl.photovoltaic.ui.bean.OidBean;
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.utils.AppManagerUtils;
+import com.hdl.photovoltaic.utils.GPSManagerUtils;
import com.hdl.photovoltaic.utils.PermissionUtils;
import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
import com.hdl.sdk.link.HDLLinkLocalSdk;
@@ -107,7 +108,7 @@
* 涓婁紶鏋佸厜娉ㄥ唽ID鍒颁簯绔�
*/
private void pushTokens() {
- String registrationId_tag="registrationID_"+UserConfigManage.getInstance().getUserId();
+ String registrationId_tag = "registrationID_" + UserConfigManage.getInstance().getUserId();
String is_registrationID = HDLApp.getInstance().getKey(registrationId_tag);
if (is_registrationID.equals("true")) {
//涓婅繃灏辨病鏈夊繀瑕佸湪涓婁紶鍟�
@@ -533,38 +534,9 @@
* 鍒濆鍖栥�愬紑鍚畾浣嶃�戝拰銆愪綅缃俊鎭�戞潈闄�
*/
private void locationUpdates() {
-
-
// 鍒濆鍖朙ocationManager瀵硅薄
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
-// //INTERNET 鍏佽浣跨敤缃戠粶
-// //ACCESS_FINE_LOCATION 鍏佽浣跨敤GPS瀹氫綅
-// //ACCESS_COARSE_LOCATION 鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣�
-// if (ActivityCompat.checkSelfPermission(_mActivity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
-// // TODO: Consider calling
-// // ActivityCompat#requestPermissions
-// // here to request the missing permissions, and then overriding
-// // public void onRequestPermissionsResult(int requestCode, String[] permissions,
-// // int[] grantResults)
-// // to handle the case where the user grants the permission. See the documentation
-// // for ActivityCompat#requestPermissions for more details.
-// return;
-// }
-// HdlLogLogic.print("寮�濮嬬含搴︾粡搴�--->", false);
-// Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
-//
-// //寤鸿杩欎釜 minTime 涓嶅皬浜� 60000锛屽嵆 1 鍒嗛挓锛岃繖鏍蜂細鏇村姞楂樻晥鑰屼笖鐪佺數
-// locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new LocationListener() {
-// @Override
-// public void onLocationChanged(@NonNull Location location) {
-// // 褰撲綅缃彂鐢熷彉鍖栨椂璋冪敤姝ゆ柟娉�
-// double latitude = location.getLatitude(); // 鑾峰彇绾害
-// double longitude = location.getLongitude(); // 鑾峰彇缁忓害
-//
-// HdlLogLogic.print("绾害--->" + latitude, true);
-// HdlLogLogic.print("缁忓害--->" + longitude, true);
-// }
-// });
+ GPSManagerUtils.getInstance().getLocation(this);
// 鍒ゆ柇璁惧鏄惁鏀寔瀹氫綅鍔熻兘
if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
// 鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鍔熻兘鎴栬�呭紩瀵肩敤鎴峰幓绯荤粺璁剧疆椤甸潰鎵撳紑瀹氫綅鍔熻兘
@@ -590,40 +562,8 @@
}
});
- } else {
- //INTERNET 鍏佽浣跨敤缃戠粶
- //ACCESS_FINE_LOCATION 鍏佽浣跨敤GPS瀹氫綅
- //ACCESS_COARSE_LOCATION 鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣�
- if (ActivityCompat.checkSelfPermission(_mActivity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- // TODO: Consider calling
- // ActivityCompat#requestPermissions
- // here to request the missing permissions, and then overriding
- // public void onRequestPermissionsResult(int requestCode, String[] permissions,
- // int[] grantResults)
- // to handle the case where the user grants the permission. See the documentation
- // for ActivityCompat#requestPermissions for more details.
- return;
- }
- HdlLogLogic.print("寮�濮嬬含搴︾粡搴�--->", false);
-// Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
-
- //寤鸿杩欎釜 minTime 涓嶅皬浜� 60000锛屽嵆 1 鍒嗛挓锛岃繖鏍蜂細鏇村姞楂樻晥鑰屼笖鐪佺數
- locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60 * 1000, 10, new LocationListener() {
- @Override
- public void onLocationChanged(@NonNull Location location) {
- // 褰撲綅缃彂鐢熷彉鍖栨椂璋冪敤姝ゆ柟娉�
- double latitude = location.getLatitude(); // 鑾峰彇绾害
- double longitude = location.getLongitude(); // 鑾峰彇缁忓害
-
-
- HdlLogLogic.print("绾害--->" + latitude, false);
- HdlLogLogic.print("缁忓害--->" + longitude, false);
- }
- });
}
-
}
-
}
\ No newline at end of file
--
Gitblit v1.8.0