Jelajahi Sumber

Apex & drivers
服务框架修改

Ray Zhang 7 tahun lalu
induk
melakukan
8a1153659a

+ 6 - 0
ApexDrivers/RAUtilsLibrary/RAUtilsLibrary.iml

@@ -115,14 +115,18 @@
     <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.0@jar" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-27.1.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-location-11.0.0" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:support-compat-27.1.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-media-compat-25.2.0" level="project" />
     <orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel-1.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement-11.0.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-27.1.1" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:support-core-ui-27.1.1" level="project" />
     <orderEntry type="library" name="Gradle: __local_aars__:/Users/ray/Documents/code_ERPSuiteAndroid/ApexDrivers/RAUtilsLibrary/libs/bcprov-jdk15on-157.jar:unspecified@jar" level="project" />
     <orderEntry type="library" name="Gradle: __local_aars__:/Users/ray/Documents/code_ERPSuiteAndroid/ApexDrivers/RAUtilsLibrary/libs/httpmime-4.1.1.jar:unspecified@jar" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:support-core-utils-27.1.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base-11.0.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-core-3.0.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
@@ -131,12 +135,14 @@
     <orderEntry type="library" name="Gradle: android.arch.core:runtime-1.1.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:monitor-1.0.2" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-v4-25.2.0" level="project" />
     <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-27.1.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource-3.0.2" level="project" />
     <orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core-1.1.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
     <orderEntry type="library" name="Gradle: android.arch.core:common:1.1.0@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks-11.0.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" />
     <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime-1.1.0" level="project" />
   </component>

+ 1 - 0
ApexDrivers/RAUtilsLibrary/build.gradle

@@ -48,6 +48,7 @@ dependencies {
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
     implementation files('libs/bcprov-jdk15on-157.jar')
     implementation files('libs/httpmime-4.1.1.jar')
+    compile 'com.google.android.gms:play-services-location:11.0.0'
 }
 
 

+ 195 - 97
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/service/RAService.java

@@ -12,8 +12,6 @@ import android.content.IntentFilter;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.os.AsyncTask;
@@ -21,16 +19,25 @@ import android.os.Binder;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.IBinder;
+import android.support.annotation.NonNull;
 import android.support.v4.app.ActivityCompat;
 import android.support.v4.app.NotificationCompat;
 import android.text.TextUtils;
 import android.util.Log;
 
+import com.google.android.gms.location.FusedLocationProviderClient;
+import com.google.android.gms.location.LocationCallback;
+import com.google.android.gms.location.LocationRequest;
+import com.google.android.gms.location.LocationResult;
+import com.google.android.gms.location.LocationServices;
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
 import com.usai.redant.rautils.R;
 import com.usai.redant.rautils.receiver.RABroadcast;
 import com.usai.redant.rautils.receiver.RABroadcastReceiver;
 import com.usai.redant.rautils.upload.RAUploadManager;
 import com.usai.redant.rautils.utils.Network;
+import com.usai.redant.rautils.utils.RAUtil;
 import com.usai.redant.rautils.utils.dbgUtil;
 
 import org.json.JSONException;
@@ -43,9 +50,9 @@ public abstract class RAService extends Service {
 
     private static final String TAG = "RAService";
 
-    public static final int DEFAULT_LOCATION_TIMEINTERVAL = 60 * 1000;
-    public static final int DEFAULT_DISTANCE = 60 * 50;
-    public static final int DEFAULT_PUSHNOTIFICATION_TIMEINTERVAL = 5 * 1000;
+    public static final int DEFAULT_LOCATION_TIMEINTERVAL = 30 * 1000;
+//    public static final int DEFAULT_DISTANCE = 0 * 50;
+    public static final int DEFAULT_PUSHNOTIFICATION_TIMEINTERVAL = 30 * 1000;
 
     public static final int FLAG_SERVICE_NONE = 0;
     public static final int FLAG_SERVICE_LOCATION = 1 << 1;
@@ -76,10 +83,30 @@ public abstract class RAService extends Service {
     }
 
     // sub function location
-    LocationListener locationListener = null;
-    LocationManager locationManager = null;
-    int locationTracing_timeInterval = DEFAULT_LOCATION_TIMEINTERVAL;
-    int locationTracing_distance = DEFAULT_DISTANCE;
+//    LocationListener locationListener = null;
+//    LocationManager locationManager = null;
+
+    private LocationRequest mLocationRequest;
+
+    /**
+     * Provides access to the Fused Location Provider API.
+     */
+    private FusedLocationProviderClient mFusedLocationClient;
+
+    /**
+     * Callback for changes in location.
+     */
+    private LocationCallback mLocationCallback;
+
+//    private Handler mServiceHandler;
+
+    /**
+     * The current location.
+     */
+    private Location mLocation;
+
+//    int locationTracing_timeInterval = DEFAULT_LOCATION_TIMEINTERVAL;
+//    int locationTracing_distance = DEFAULT_DISTANCE;
     //    protected abstract void onLocationChanged(Location location);
     private ServiceLocation locationCallback = null;
 
@@ -98,8 +125,62 @@ public abstract class RAService extends Service {
         service_flag = service_flag | FLAG_SERVICE_LOCATION;
         this.locationCallback = locationCallback;
     }
+    /**
+     * Sets the location request parameters.
+     */
+    private void createLocationRequest() {
+        mLocationRequest = new LocationRequest();
+        mLocationRequest.setInterval(DEFAULT_LOCATION_TIMEINTERVAL);
+        mLocationRequest.setFastestInterval(DEFAULT_LOCATION_TIMEINTERVAL/2);
+        mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
 
+    }
+
+    private void requestLocationUpdates() {
+        Log.i(TAG, "Requesting location updates");
+//        Utils.setRequestingLocationUpdates(this, true);
+//        startService(new Intent(getApplicationContext(), LocationUpdatesService.class));
+        try {
+            mFusedLocationClient.requestLocationUpdates(mLocationRequest,
+                    mLocationCallback, null);
+        } catch (SecurityException unlikely) {
+//            Utils.setRequestingLocationUpdates(this, false);
+            Log.e(TAG, "Lost location permission. Could not request updates. " + unlikely);
+        }
+    }
 
+    /**
+     * Removes location updates. Note that in this sample we merely log the
+     * {@link SecurityException}.
+     */
+    private void removeLocationUpdates() {
+        Log.i(TAG, "Removing location updates");
+        try {
+            mFusedLocationClient.removeLocationUpdates(mLocationCallback);
+//            Utils.setRequestingLocationUpdates(this, false);
+            stopSelf();
+        } catch (SecurityException unlikely) {
+//            Utils.setRequestingLocationUpdates(this, true);
+            Log.e(TAG, "Lost location permission. Could not remove updates. " + unlikely);
+        }
+    }
+    private void getLastLocation() {
+        try {
+            mFusedLocationClient.getLastLocation()
+                    .addOnCompleteListener(new OnCompleteListener<Location>() {
+                        @Override
+                        public void onComplete(@NonNull Task<Location> task) {
+                            if (task.isSuccessful() && task.getResult() != null) {
+                                mLocation = task.getResult();
+                            } else {
+                                Log.w(TAG, "Failed to get location.");
+                            }
+                        }
+                    });
+        } catch (SecurityException unlikely) {
+            Log.e(TAG, "Lost location permission." + unlikely);
+        }
+    }
     // sub function Notification
     protected String url_checknotification = null;
     int pushcheck_timeInterval = DEFAULT_PUSHNOTIFICATION_TIMEINTERVAL;
@@ -287,24 +368,7 @@ public abstract class RAService extends Service {
         }
     }
 
-    public void checkpush(Context context) {
-
-        if(true)
-        return;
-        if (m_task != null) {
-            return;
-        }
-        // mStatusMessageView.setText(R.string.str_Loading);
-        // showProgress(true);
-        m_task = new checkPushTask(context);
-
-        // TextView text_page = (TextView) view_page_footer
-        // .findViewById(R.id.text_page);
-        // text_page.setText("Loading...");
-        // text_page.setEnabled(false);
-        m_task.execute();
-
-    }
+//
 
     public RAService() {
     }
@@ -329,7 +393,11 @@ public abstract class RAService extends Service {
             return RAService.this;
         }
     }
-
+    @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+        Log.d("_SERVICE", "onStartCommand");
+        return super.onStartCommand(intent,flags,startId);
+    }
 
     @Override
     public void onCreate() {
@@ -380,39 +448,59 @@ public abstract class RAService extends Service {
             msgFilter.addAction(RABroadcast.ACTION_LOCATION_DISABLE_TRACING);
             msgFilter.addAction(RABroadcast.ACTION_LOCATION_REQUEST_LOCATION);
 //            msgFilter.addAction("REDANT.BROADCAST.RESET_LOCATION");
-            locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
-
-            locationListener = new LocationListener() {
-
-                // Provider的状态在可用、暂时不可用和无服务三个状态直接切换时触发此函数
-                @Override
-                public void onStatusChanged(String provider, int status,
-                                            Bundle extras) {
+//            locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+//
+//            locationListener = new LocationListener() {
+//
+//                // Provider的状态在可用、暂时不可用和无服务三个状态直接切换时触发此函数
+//                @Override
+//                public void onStatusChanged(String provider, int status,
+//                                            Bundle extras) {
+//
+//                }
+//
+//                // Provider被enable时触发此函数,比如GPS被打开
+//                @Override
+//                public void onProviderEnabled(String provider) {
+//
+//                }
+//
+//                // Provider被disable时触发此函数,比如GPS被关闭
+//                @Override
+//                public void onProviderDisabled(String provider) {
+//
+//                }
+//
+//                // 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发
+//                @Override
+//                public void onLocationChanged(Location location) {
+//                    locationCallback.onLocationChanged(location);
+//
+//                }
+//            };
 
-                }
 
-                // Provider被enable时触发此函数,比如GPS被打开
-                @Override
-                public void onProviderEnabled(String provider) {
 
-                }
+            mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
 
-                // Provider被disable时触发此函数,比如GPS被关闭
+            mLocationCallback = new LocationCallback() {
                 @Override
-                public void onProviderDisabled(String provider) {
-
-                }
-
-                // 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发
-                @Override
-                public void onLocationChanged(Location location) {
-                    locationCallback.onLocationChanged(location);
+                public void onLocationResult(LocationResult locationResult) {
+                    super.onLocationResult(locationResult);
 
+                    Log.i(TAG, "onLocationResult: " + locationResult.getLastLocation());
+//                    onNewLocation(locationResult.getLastLocation());
                 }
             };
 
+            createLocationRequest();
+            getLastLocation();
+
+//            HandlerThread handlerThread = new HandlerThread(TAG);
+//            handlerThread.start();
+//            mServiceHandler = new Handler(handlerThread.getLooper());
 
-            enable_locationTracing(locationTracing_timeInterval, locationTracing_distance);
+            enable_locationTracing();
 
 
 //          msgFilter.addAction("REDANT.POP.GPS_ON");
@@ -460,9 +548,10 @@ public abstract class RAService extends Service {
     @Override
     public void onDestroy() {
         Log.e("_SERVICE", "onDestroy: ");
-        if (uploadManager != null)
-            uploadManager.saveTasks();
-
+//        if (uploadManager != null)
+//            uploadManager.saveTasks();
+//        if(mServiceHandler!=null)
+//            mServiceHandler.removeCallbacksAndMessages(null);
         unregisterReceiver(uploadReceiver);
         super.onDestroy();
     }
@@ -515,10 +604,10 @@ public abstract class RAService extends Service {
                     int iconntype = -1;
                     iconntype = networkInfo
                             .getType();
-                    SharedPreferences pref = getApplication()
-                            .getSharedPreferences(
-                                    "UploadManager",
-                                    0);
+
+
+                    SharedPreferences pref = RAUtil.sharedPreferences(getApplicationContext(),"UploadManager");
+
 
 
                     boolean wifi_only = pref.getBoolean("wifi_only", false);
@@ -536,7 +625,7 @@ public abstract class RAService extends Service {
 
 
             } else if (RABroadcast.ACTION_LOCATION_ENABLE_TRACING.equals(action)) {
-                enable_locationTracing(locationTracing_timeInterval, locationTracing_distance);
+                enable_locationTracing();
             } else if (RABroadcast.ACTION_LOCATION_DISABLE_TRACING
                     .equals(action)) {
 
@@ -669,11 +758,12 @@ public abstract class RAService extends Service {
 
 
     void disable_locationTracing() {
-        locationManager.removeUpdates(locationListener);
+        removeLocationUpdates();
+//        locationManager.removeUpdates(locationListener);
     }
 
 
-    void enable_locationTracing(int timeInterval, int distance) {
+    void enable_locationTracing() {
 
         if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
             // TODO: Consider calling
@@ -686,10 +776,10 @@ public abstract class RAService extends Service {
             return;
         }
 
-
-        locationManager.requestLocationUpdates(
-                "fused", timeInterval, distance,
-                locationListener);
+        requestLocationUpdates();
+//        locationManager.requestLocationUpdates(
+//                "fused", timeInterval, distance,
+//                locationListener);
 //        if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
 //
 //
@@ -714,8 +804,9 @@ public abstract class RAService extends Service {
 
 
         //使用GPS获取上一次的地址,这样获取到的信息需要多次,才能够显示出来,所以后面有动态的判断
-        Location location = locationManager.getLastKnownLocation("fused");
-        return location;
+//        Location location = locationManager.getLastKnownLocation("fused");
+//        return location;
+        return null;
 
     }
 
@@ -745,36 +836,43 @@ public abstract class RAService extends Service {
             return;
         }
 
-        LocationListener singleListener = new LocationListener() {
-            @Override
-            public void onLocationChanged(Location location) {
-
-                Intent Bintent = new Intent(RABroadcast.EVENT_RETURN_LOCATION);
-                Bintent.putExtra("location", location);
-                Bintent.putExtra("receiverID", receiverID);
-                sendBroadcast(Bintent);
-
-
-            }
-
-            @Override
-            public void onStatusChanged(String s, int i, Bundle bundle) {
-
-            }
-
-            @Override
-            public void onProviderEnabled(String s) {
-
-            }
-
-            @Override
-            public void onProviderDisabled(String s) {
-
-            }
-        };
-
-
-        locationManager.requestSingleUpdate("fused", singleListener, null);
+        return;
+//        LocationListener singleListener = new LocationListener() {
+//            @Override
+//            public void onLocationChanged(Location location) {
+//
+//
+//
+//                if(location==null)
+//                    Log.d("ApexDriversB..Service", "onLocationChanged: null");
+//                else
+//                    Log.d("ApexDriversB..Service", "single location onLocationChanged: "+location.getLongitude()+" , "+location.getLatitude());
+//                Intent Bintent = new Intent(RABroadcast.EVENT_RETURN_LOCATION);
+//                Bintent.putExtra("location", location);
+//                Bintent.putExtra("receiverID", receiverID);
+//                sendBroadcast(Bintent);
+//
+//
+//            }
+//
+//            @Override
+//            public void onStatusChanged(String s, int i, Bundle bundle) {
+//
+//            }
+//
+//            @Override
+//            public void onProviderEnabled(String s) {
+//
+//            }
+//
+//            @Override
+//            public void onProviderDisabled(String s) {
+//
+//            }
+//        };
+//
+//
+//        locationManager.requestSingleUpdate("fused", singleListener, null);
 
 
     }

+ 10 - 9
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/upload/RAUploadManager.java

@@ -122,7 +122,7 @@ public class RAUploadManager {
         queue_status = QueueStatus.QueueStatusDefault;
 
 
-        SharedPreferences UMSetting = applicationContext.getSharedPreferences("UploadManager", 0);
+        SharedPreferences UMSetting = RAUtil.sharedPreferences(applicationContext,"UploadManager");
 
         if (UMSetting != null) {
 //            autoStart = UMSetting.getBoolean("auto_upload",false);
@@ -216,12 +216,13 @@ public class RAUploadManager {
 
                 int waiting = taskinfo.getInt("retry_waiting", 0);
 
-                int newwaiting = waiting;
-                if (newwaiting / 60.0 < 20)
-                    newwaiting += retryWaiting;
-                if (newwaiting > 1200)
-                    newwaiting = 1200;
-                taskinfo.putInt("retry_waiting", newwaiting);
+                // waiting 时间根据次数累加,最多不超过20分钟
+                int nextwaiting = waiting;
+                if (nextwaiting / 60.0 < 20)
+                    nextwaiting += retryWaiting;
+                if (nextwaiting > 1200)
+                    nextwaiting = 1200;
+                taskinfo.putInt("retry_waiting", nextwaiting);
 
                 //                try{
                 try {
@@ -404,7 +405,7 @@ public class RAUploadManager {
 
         Log.d("_RAIMAGE", "saveTasks: RAUploadManager");
 
-        SharedPreferences pref = applicationContext.getSharedPreferences("RA Image", 0);
+        SharedPreferences pref = RAUtil.sharedPreferences(applicationContext,"UploadManager");
         try {
             String tasksBase64 = pref.getString("task_list", "");
 
@@ -671,7 +672,7 @@ public class RAUploadManager {
 
         Log.d("_RAIMAGE", "saveTasks: RAUploadManager");
 
-        SharedPreferences pref = applicationContext.getSharedPreferences("RA Image", 0);
+        SharedPreferences pref = RAUtil.sharedPreferences(applicationContext,"UploadManager");//applicationContext.getSharedPreferences("RA Image", 0);
         SharedPreferences.Editor editor = pref.edit();
 
         try {

+ 14 - 0
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/RAUtil.java

@@ -4,6 +4,7 @@ import android.Manifest;
 import android.app.Activity;
 import android.app.Application;
 import android.content.Context;
+import android.content.SharedPreferences;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.os.Build;
@@ -39,7 +40,20 @@ public class RAUtil {
     public static void LibTest() {
         dbgUtil.Logd("RAUtilsLibrary", "LibTest aar update successful");
     }
+    public static SharedPreferences sharedPreferences(Context context,String key) {
 
+        SharedPreferences pref=null;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
+        {
+            Context c= context.createDeviceProtectedStorageContext();
+            pref = c.getSharedPreferences(key, 0);
+        }
+        else
+        {
+            pref = context.getSharedPreferences(key, 0);
+        }
+        return pref;
+    }
     public static String getApplicationName(Context context) {
 
         PackageManager packageManager = null;

+ 2 - 2
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/dbgUtil.java

@@ -3,10 +3,8 @@ package com.usai.redant.rautils.utils;
 import android.Manifest;
 import android.content.Context;
 import android.database.Cursor;
-import android.os.Environment;
 import android.util.Log;
 
-
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -74,9 +72,11 @@ public class dbgUtil
 			return;
 		}
 
+
 		String logDir = logDir(appContext);
 
 		File dir = new File(logDir);
+
 		if (!dir.exists())
 			dir.mkdirs();
 

+ 11 - 3
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/ApexDriversBackgroundService.java

@@ -13,6 +13,7 @@ import org.json.JSONObject;
 
 public class ApexDriversBackgroundService extends RAService implements RAService.ServiceLocation, RAService.ServicePushNotification,RAService.ServiceUpload{
 
+    //负责上传及定位
 //    public RAUploadManager uploadManager = new RAUploadManager(ApexDriverApplication.sharedApplication().getApplicationContext());
 
     public ApexDriversBackgroundService() {
@@ -24,8 +25,8 @@ public class ApexDriversBackgroundService extends RAService implements RAService
 //        service_flag=FLAG_SERVICE_UPLOAD|FLAG_SERVICE_NOTIFICATION|FLAG_SERVICE_LOCATION;
 
         initServiceLocation(this);
-        initServiceNotification(this,"replace this string with notification checking url");
-//        initServiceUpload(this);
+//        initServiceNotification(this,"replace this string with notification checking url");
+        initServiceUpload(this);
 
         dbgUtil.fileLog(this,"ApexDriversBackgroundService Setup()");
     }
@@ -43,7 +44,14 @@ public class ApexDriversBackgroundService extends RAService implements RAService
     @Override
     public void onLocationChanged(Location location) {
 
-        Log.d("ApexDriversB..Service", "onLocationChanged: ");
+        Log.d("ApexDriversB..Service", "onLocationChanged");
+        Log.d("ApexDriversB..Service", "request single location");
+        request_location("123");
+//
+//        if(location==null)
+//            Log.d("ApexDriversB..Service", "onLocationChanged: null");
+//        else
+//            Log.d("ApexDriversB..Service", "onLocationChanged: "+location.getLongitude()+" , "+location.getLatitude());
     }
 
     @Override

+ 2 - 1
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/receiver/ApexDriverAlarmReceiver.java

@@ -13,6 +13,7 @@ import com.usai.redant.rautils.receiver.RABroadcast;
 import com.usai.redant.rautils.utils.RAUtil;
 
 public class ApexDriverAlarmReceiver extends AlarmReceiver {
+    //负责通过alarm 从后台取notification 列表
     protected  int alarm_timeInterval = 30 * 1000;
 
     protected static final int	SO_TIMEOUT						= 15 * 1000;
@@ -138,7 +139,7 @@ public class ApexDriverAlarmReceiver extends AlarmReceiver {
 
 
         String dev_id = RAUtil.getDeviceId(context);
-        Log.d("ApexDriverAlarmReceiver", "check_push: "+dev_id);
+        Log.d("ApexDriverAlarmReceiver", "check_push: not implementation"+dev_id);
 
 
         return ;

+ 1 - 0
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/receiver/ApexDriverBootCompleteReceiver.java

@@ -12,6 +12,7 @@ import com.usai.redant.rautils.utils.dbgUtil;
 
 public class ApexDriverBootCompleteReceiver extends BootCompleteBroadcastReceiver {
 
+	//负责启动service
 //    @Override
 //    public void onReceive(Context context, Intent intent) {
 //        // TODO: This method is called when the BroadcastReceiver is receiving