管灌系统巡查员智能手机App
app/src/main/java/com/dayu/pipirrapp/activity/OrderDealActivity.java
@@ -35,6 +35,8 @@
import com.dayu.pipirrapp.tool.GlideEngine;
import com.dayu.pipirrapp.tool.ImageFileCompressEngine;
import com.dayu.pipirrapp.utils.CommonKeyName;
import com.dayu.pipirrapp.utils.MyLog;
import com.dayu.pipirrapp.utils.ServiceUtils;
import com.dayu.pipirrapp.utils.ToastUtil;
import com.dayu.pipirrapp.view.TitleBar;
import com.jeremyliao.liveeventbus.LiveEventBus;
@@ -68,7 +70,7 @@
 * @since 2024-11-27
 */
public class OrderDealActivity extends BaseActivity {
    private String TAG = "OrderDealActivity";
    private final String TAG = "OrderDealActivity";
    ActivityOrderDealBinding binding;
    RecyclerView mRecyclerView;
    AddPictureAdapter mAdapter;
@@ -87,6 +89,7 @@
    private Observer<Object> locationObserver = new Observer<Object>() {
        @Override
        public void onChanged(Object o) {
            MyLog.d("OrderDealActivity>>>locationObserver>>");
            latLonBean = (LatLonBean) o;
        }
    };
@@ -340,13 +343,15 @@
     * 开始定位相关逻辑
     */
    private void startLocation() {
        Intent location = new Intent(this, MyLocationService.class);
        location.putExtra("isSingle", true);
        //开启定位
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            startForegroundService(location);
        } else {
            startService(location);
        if (!ServiceUtils.isServiceRunning(this, MyLocationService.class)) {
            Intent location = new Intent(this, MyLocationService.class);
            location.putExtra("isSingle", true);
            //开启定位
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                startForegroundService(location);
            } else {
                startService(location);
            }
        }
        //获取定位服务传过来的坐标点
        LiveEventBus.get(CommonKeyName.locationData).observeForever(locationObserver);