Jelajahi Sumber

Apex & drivers
拆分,新建app 工程 apex & drivers cn 和 apex & drivers i

Ray Zhang 7 tahun lalu
induk
melakukan
7fc0159744

+ 32 - 21
ApexDrivers/RAUtilsLibrary/RAUtilsLibrary.iml

@@ -85,53 +85,64 @@
       <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/attr" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/extractedTypedefs" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/intermediate-jars" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_and_local_jars_jni" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged-aidl" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged-classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/packagedAssets" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged_res" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/public_res" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
     </content>
-    <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
+    <orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner-1.0.2" level="project" />
-    <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" name="Gradle: com.android.support:animated-vector-drawable-26.1.0" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks-16.0.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-26.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-fragment-26.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.core:common:1.0.0@jar" 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: com.google.android.gms:play-services-basement-16.0.1" 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" name="Gradle: com.android.support:support-media-compat-26.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-annotations:26.1.0@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-v4-26.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-compat-26.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base-16.0.1" 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" />
-    <orderEntry type="library" name="Gradle: com.android.support:support-fragment-27.1.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
-    <orderEntry type="library" name="Gradle: android.arch.core:runtime-1.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.google.android.gms:play-services-places-placereport-16.0.0" level="project" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.0.0@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-26.1.0" level="project" />
+    <orderEntry type="library" name="Gradle: com.android.support:support-core-ui-26.1.0" 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" name="Gradle: com.android.support:support-core-utils-26.1.0" 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" name="Gradle: com.google.android.gms:play-services-location-16.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" />
+    <orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime-1.0.0" level="project" />
   </component>
 </module>

+ 11 - 3
ApexDrivers/RAUtilsLibrary/build.gradle

@@ -1,7 +1,7 @@
 apply plugin: 'com.android.library'
 
 android {
-    compileSdkVersion 27
+    compileSdkVersion 26
     defaultConfig {
 //        applicationId "com.usai.redant.rautils"
         minSdkVersion 21
@@ -39,16 +39,24 @@ android {
             }
 //        }
     }
+    gradle.projectsEvaluated {
+        tasks.withType(JavaCompile) {
+//            options.compilerArgs << "-Xlint:deprecation"
+            options.compilerArgs << "-Xlint:unchecked"
+
+        }
+    }
 }
 
 dependencies {
-    implementation 'com.android.support:appcompat-v7:27.1.1'
+
+    implementation 'com.android.support:appcompat-v7:26.1.0'
     testImplementation 'junit:junit:4.12'
     androidTestImplementation 'com.android.support.test:runner:1.0.2'
     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')
-    implementation 'com.google.android.gms:play-services-location:11.0.0'
+    api 'com.google.android.gms:play-services-location:16.0.0'
 }
 
 

+ 0 - 678
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/AppImpl.java

@@ -1,678 +0,0 @@
-package com.usai.redant.rautils;
-
-import android.Manifest;
-import android.app.AlarmManager;
-import android.app.Application;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-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;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.support.v4.app.ActivityCompat;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.usai.redant.rautils.receiver.RABroadcast;
-import com.usai.redant.rautils.upload.RAUploadManager;
-import com.usai.redant.rautils.utils.Network;
-import com.usai.redant.rautils.utils.dbgUtil;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-
-public abstract class AppImpl extends Application {
-    protected static AppImpl mApp;
-
-    private static final String TAG = "AppImpl";
-
-    public static final int DEFAULT_LOCATION_TIMEINTERVAL = 60 * 1000;
-    public static final int DEFAULT_DISTANCE = 60 * 50;
-    public static final int DEFAULT_PUSHNOTIFICATION_TIMEINTERVAL = 30 * 1000;
-
-    public static final int FLAG_MODULE_NONE = 0;
-    public static final int FLAG_MODULE_LOCATION = 1 << 1;
-    public static final int FLAG_MODULE_NOTIFICATION = 1 << 2;
-    public static final int FLAG_MODULE_UPLOAD = 1 << 3;
-//    public static final int FLAG_LOCATION_SERVICE = 1<<1;
-
-    // service setup
-    protected int service_flag = FLAG_MODULE_NONE;
-    private IntentFilter msgFilter = new IntentFilter();
-
-    protected abstract void Setup();
-
-
-    // sub function upload
-    public interface ModuleUpload {
-
-    }
-    public void initModuleUpload(AppImpl.ModuleUpload uploadCallback) {
-        service_flag = service_flag | FLAG_MODULE_UPLOAD;
-//        this.upload = locationCallback;
-    }
-
-    private RAUploadManager uploadManager = null;
-
-    public RAUploadManager getUploadManager() {
-        return uploadManager;
-    }
-
-    // sub function location
-    LocationListener locationListener = null;
-    LocationManager locationManager = null;
-    int locationTracing_timeInterval = DEFAULT_LOCATION_TIMEINTERVAL;
-    int locationTracing_distance = DEFAULT_DISTANCE;
-    //    protected abstract void onLocationChanged(Location location);
-    private AppImpl.ModuleLocation locationCallback = null;
-
-    public interface ModuleLocation {
-
-
-        public abstract  Location RequestCachedLocation();
-//        public abstract void RequestLocation_ByBroadcast(String receiverID);
-
-        public abstract void onLocationChanged(Location location);
-//        public abstract void onLogin();
-//		public abstract void onLogout();
-    }
-
-    public void initModuleLocation(AppImpl.ModuleLocation locationCallback) {
-        service_flag = service_flag | FLAG_MODULE_LOCATION;
-        this.locationCallback = locationCallback;
-    }
-
-
-    // sub function Notification
-    protected String url_checknotification = null;
-    int pushcheck_timeInterval = DEFAULT_PUSHNOTIFICATION_TIMEINTERVAL;
-    protected static final int NOTIFICATION_TYPE_PUSHNOTIFICATION = 0;
-    protected static final int NOTIFICATION_TYPE_SILENCECOMMAND = 1;
-    protected boolean enable_pushNotification = false;
-
-    //    protected abstract Notification prepareNotification(JSONObject msg);
-//    protected abstract void handleSilenceMessage(JSONObject msg);
-    public interface ModulePushNotification {
-        public abstract Notification prepareNotification(JSONObject msg);
-
-        public abstract void handleSilenceMessage(JSONObject msg);
-    }
-
-    public void initModuleNotification(AppImpl.ModulePushNotification pushNotificationCallback, String url_checknotification) {
-        service_flag = service_flag | FLAG_MODULE_NOTIFICATION;
-        this.url_checknotification = url_checknotification;
-        this.pushNotificationCallback = pushNotificationCallback;
-    }
-
-    private AppImpl.ModulePushNotification pushNotificationCallback = null;
-    private AppImpl.checkPushTask m_task = null;
-
-    class checkPushTask extends AsyncTask<Void, Void, Boolean> {
-        int errorcode;
-        String content = null;
-        Context mcontext;
-
-        public checkPushTask(Context context) {
-            mcontext = context;
-        }
-
-        @Override
-        protected Boolean doInBackground(Void... params) {
-            Log.d("SearchTask", "doInBackground");
-
-            if (!Network.isNetworkAvailable(AppImpl.getInstance()))
-
-            {
-                errorcode = Network.RESULT_NET_NOTAVAILABLE;
-                return false;
-            }
-            String jstr = "";
-            jstr = Network.check_push(mcontext, new Bundle(), url_checknotification);
-            // if (module_name.equals("Announcements"))
-            // jstr = Network.get_announcements(lastid, limit);
-            // else
-            // jstr = Network.get_marketnews(lastid, limit);
-            if (jstr == null || jstr.length() <= 0) {
-                // Log.d(TAG, "json is wrong");
-
-                errorcode = Network.RESULT_NET_ERROR;
-                return false;
-            }
-
-            content = jstr;
-            return true;
-        }
-
-        @Override
-        protected void onPostExecute(Boolean success) {
-            String tag = "onPostExec";
-            Log.i(tag, "entry");
-            m_task = null;
-
-
-            if (success) {
-                JSONObject jsobj;
-                //
-                // array = new JSONArray(json);
-                try {
-                    jsobj = new JSONObject(content);
-
-                    int count = jsobj.getInt("count");
-
-                    for (int i = 0; i < count; i++) {
-                        JSONObject msg = jsobj.getJSONObject("msg_" + i);
-                        int type = msg.getInt("type");
-                        if (type == NOTIFICATION_TYPE_SILENCECOMMAND) {
-
-                            pushNotificationCallback.handleSilenceMessage(msg);
-                            Intent intent = new Intent(RABroadcast.EVENT_SILENCECOMMAND);
-                            intent.putExtra("msg", msg.toString());
-                            sendBroadcast(intent);
-
-                        } else {
-                            pushNotification(msg);
-
-                            Intent intent = new Intent(RABroadcast.EVENT_PUSHNOTIFICATION);
-                            intent.putExtra("msg", msg.toString());
-                            sendBroadcast(intent);
-
-
-                        }
-                    }
-
-
-                } catch (JSONException e) {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
-                }
-
-            }
-
-            super.onPostExecute(success);
-        }
-
-        @Override
-        protected void onCancelled() {
-            m_task = null;
-            // showProgress(false);
-        }
-    }
-
-
-    public void pushNotification(JSONObject msg) {
-
-        if (enable_pushNotification) {
-
-            boolean bsound = true;
-//                    mcontext.getSharedPreferences(
-//                    "setting", 0).getBoolean(
-//                    "notifications_new_message_sound", true);
-            boolean bvibrate = true;
-//            mcontext.getSharedPreferences(
-//                    "setting", 0).getBoolean(
-//                    "notifications_new_message_vibrate", true);
-            NotificationManager nManager = (NotificationManager)
-                    getSystemService(Context.NOTIFICATION_SERVICE);
-
-/*
-       此部分在虚函数 prepareNotificaiton 中实现
-            Intent intent = new Intent(mcontext,
-                    FunctionSelectActivity.class);
-            intent.putExtra("launcher", "notification");
-
-            PendingIntent pintent = PendingIntent.getActivity(
-                    this, 0, intent,
-                    PendingIntent.FLAG_UPDATE_CURRENT);
-
-
-            Notification.Builder builder = new Notification.Builder(mcontext);//新建Notification.Builder对象
-            String ntitle = "";
-            int number = ApexTrackingApplication.ncount++;
-            if (number > 1)
-                ntitle=number
-                        + " "
-                        + ApexTrackingApplication
-                        .get_instance()
-                        .getString(
-                                R.string.str_mnotification_title);
-            else
-                ntitle = ApexTrackingApplication
-                        .get_instance()
-                        .getString(
-                                R.string.str_notification_title);
-
-            builder.setContentTitle(ntitle);//设置标题
-            builder.setContentText(ApexTrackingApplication
-                    .get_instance()
-                    .getString(
-                            R.string.str_notification_text)
-                    + date);//设置内容
-            builder.setSmallIcon(R.drawable.ic_launcher);//设置图片
-            builder.setContentIntent(pintent);//执行intent
-
-
-            */
-            Notification notification = pushNotificationCallback.prepareNotification(msg);//builder.getNotification();//将builder对象转换为普通的notifications
-            notification.defaults = Notification.DEFAULT_ALL;
-
-//            if (bsound && bvibrate)
-//                notification.defaults = Notification.DEFAULT_ALL;
-//            else if (bsound)
-//                notification.defaults = Notification.DEFAULT_SOUND
-//                        | Notification.DEFAULT_LIGHTS;
-//            else if (bvibrate)
-//                notification.defaults = Notification.DEFAULT_VIBRATE
-//                        | Notification.DEFAULT_LIGHTS;
-            notification.flags = Notification.FLAG_AUTO_CANCEL;
-//            notification.number = number; //number 是不是不需要了?
-
-            nManager.notify(R.layout.support_simple_spinner_dropdown_item, notification);
-        }
-    }
-
-    public void checkpush(Context context) {
-
-        if (m_task != null) {
-            return;
-        }
-        // mStatusMessageView.setText(R.string.str_Loading);
-        // showProgress(true);
-        m_task = new AppImpl.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();
-
-    }
-
-
-
-    private BroadcastReceiver receiver = new BroadcastReceiver() {
-
-        public void onReceive(Context context, Intent intent) {
-            String action = intent
-                    .getAction();
-            // 如果捕捉到的action是ACTION_BATTERY_CHANGED
-
-            if (RABroadcast.ACTION_UPLOAD_ADD_TASK.equals(action)) {
-
-                ArrayList<Bundle> tasks = intent.getParcelableArrayListExtra("tasks");
-
-
-                uploadManager.addTasks(tasks);
-            }
-//            else if ("REDANT.RAImage.SAVE_TASK".equals(action)) {
-//                uploadManager.stopAllTasks();
-//            }
-            else if (intent
-                    .getAction()
-                    .equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
-
-                ConnectivityManager connManager = (ConnectivityManager) context
-                        .getSystemService(Context.CONNECTIVITY_SERVICE);
-
-                NetworkInfo networkInfo = connManager.getActiveNetworkInfo();
-                if (networkInfo == null) {
-                    dbgUtil.Logd(
-                            "Current Network info",
-                            "can not get Active NetworkInfo!");
-                    return;
-                }
-                NetworkInfo.State netState = networkInfo
-                        .getState();
-                if (netState != NetworkInfo.State.CONNECTED) {
-                    dbgUtil.Logd(
-                            "Current Network info",
-                            "not Connected!State="
-                                    + netState);
-                    return;
-                } else {
-
-                    int iconntype = -1;
-                    iconntype = networkInfo
-                            .getType();
-                    SharedPreferences pref =
-                            getSharedPreferences(
-                                    "UploadManager",
-                                    0);
-
-
-                    boolean
-                            wifi_only
-                            = pref.getBoolean("wifi_only",
-                            false);
-
-                    if
-                            (wifi_only
-                            == true
-                            && iconntype !=
-                            ConnectivityManager.TYPE_WIFI
-                            && iconntype !=
-                            9/* earthnet */) {
-                        uploadManager.stopAllTasks();
-//															 dbgUtil.Log(Log.DEBUG,
-//															 "Current Network info",
-//															 "not allowed!Connection type="
-//															 +
-//															 networkInfo.getTypeName());
-                        return;
-                    }
-                }
-
-
-            } else if (RABroadcast.ACTION_LOCATION_ENABLE_TRACING
-                    .equals(action)) {
-                enable_locationTracing(locationTracing_timeInterval, locationTracing_distance);
-            } else if (RABroadcast.ACTION_LOCATION_DISABLE_TRACING
-                    .equals(action)) {
-
-                disable_locationTracing();
-            } else if (RABroadcast.ACTION_LOCATION_REQUEST_LOCATION
-                    .equals(action)) {
-
-
-                String receiverID=intent.getStringExtra("receiverID");
-//                locationManager.requestSingleUpdate();
-                request_location(receiverID);
-//                locationCallback.onLocationChanged();
-            }
-            else if (RABroadcast.ACTION_PUSHNOTIFICATION_CHECK
-                    .equals(action))
-            {
-                checkpush(context);
-            }
-            else if (RABroadcast.ACTION_PUSHNOTIFICATION_ENABLE_CHECK
-                    .equals(action))
-            {
-
-                String tag = "onReceive@Alarmreceiver";
-//                Log.i( tag, "receive alarm broadcast caller =="
-//                        + intent.getStringExtra("caller"));
-
-                startalarm();
-
-//                checkpush(context);
-
-//                if (SystemClock.elapsedRealtime()
-//                        - ApexTrackingApplication.getLastCheckMessageTime() > 120000)
-//                {
-//                    Log.i(tag, "check messsage");
-//                    ApexTrackingApplication.UpdateLastCheckMessageTime();
-//                    checkpush(context);
-//
-//                }
-            }
-            else if (RABroadcast.ACTION_PUSHNOTIFICATION_DISABLE_CHECK
-                    .equals(action))
-            {
-                if (m_task != null)
-                    m_task.cancel(true);
-//                NotificationManager nManager = (NotificationManager) context
-//                        .getSystemService(Context.NOTIFICATION_SERVICE);
-//                nManager.cancel(R.layout.activity_apex);
-                cancelalarm();
-                // ApexTrackingApplication.put_password("");
-                // ApexTrackingApplication.put_sessionid("");
-                // ApexTrackingApplication.put_user("");
-//                ApexTrackingApplication.logout();
-            }
-        }
-    };
-
-    public static AppImpl getInstance() {
-        return mApp;
-    }
-    @Override
-    public void onCreate() {
-        Log.d("Apex Driver", "ApexDriverApplication onCreate: ");
-        super.onCreate();
-
-        mApp = this;
-
-
-
-        Setup();
-
-        msgFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
-
-        if ((service_flag & FLAG_MODULE_UPLOAD) == FLAG_MODULE_UPLOAD) {
-            uploadManager = new RAUploadManager(getApplicationContext());
-//            msgFilter.addAction("REDANT.POP.RESET_LOCATION");
-//            msgFilter.addAction("REDANT.POP.QUERY_UPLOAD_STATE");
-            msgFilter.addAction("REDANT.BROADCAST.ACTION_UPLOAD_ADD_TASK");
-//            msgFilter.addAction("REDANT.BROADCAST.UPLOAD_MODIFY_QUEUE");
-//            msgFilter.addAction("REDANT.BROADCAST.UPLOAD_RETRY_UPLOAD");
-        }
-        if ((service_flag & FLAG_MODULE_LOCATION) == FLAG_MODULE_LOCATION) {
-
-
-            msgFilter.addAction(RABroadcast.ACTION_LOCATION_ENABLE_TRACING);
-            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) {
-
-                }
-
-                // 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);
-
-                }
-            };
-
-
-            enable_locationTracing(locationTracing_timeInterval, locationTracing_distance);
-
-
-//          msgFilter.addAction("REDANT.POP.GPS_ON");
-//		    msgFilter.addAction("REDANT.POP.GPS_OFF");
-//		    msgFilter.addAction("REDANT.POP.REQUEST_LOCATION");
-        }
-        if ((service_flag & FLAG_MODULE_NOTIFICATION) == FLAG_MODULE_NOTIFICATION) {
-
-            if (TextUtils.isEmpty(url_checknotification)) {
-                Log.e(TAG, "onCreate: setup FLAG_SERVICE_NOTIFICATION without url_checknotification");
-            }
-
-            msgFilter.addAction("REDANT.BROADCAST.ACTION_PUSHNOTIFICATION_CHECK");
-
-        }
-
-        registerReceiver(receiver, msgFilter);
-
-        super.onCreate();
-
-    }
-
-
-    //check push
-    private void startalarm()
-    {
-
-//        SharedPreferences pref = getSharedPreferences("Apex", 0);
-//        boolean autologin = pref.getBoolean("autologin", false);
-//        if (autologin == false)
-//            return;
-
-        // 启动完成
-        Intent iAlarm = new Intent(this, BroadcastReceiver.class);
-//        iAlarm.putExtra("caller", caller);
-        iAlarm.setAction(RABroadcast.ACTION_PUSHNOTIFICATION_CHECK);
-        PendingIntent sender = PendingIntent.getBroadcast(this, 0,
-                iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
-
-        long firstime = SystemClock.elapsedRealtime();
-//		UpdateLastAlermTime();
-        AlarmManager am = (AlarmManager) this.getSystemService(
-                Context.ALARM_SERVICE);
-
-        // 30秒一个周期,不停的发送广播
-        am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstime,
-                pushcheck_timeInterval, sender);
-    }
-
-    private void cancelalarm()
-    {
-
-        // 启动完成
-        Intent iAlarm = new Intent(this, BroadcastReceiver.class);
-        iAlarm.setAction(RABroadcast.ACTION_PUSHNOTIFICATION_CHECK);
-        PendingIntent sender = PendingIntent.getBroadcast(this, 0,
-                iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
-
-        AlarmManager am = (AlarmManager) getSystemService(
-                Context.ALARM_SERVICE);
-
-        am.cancel(sender);
-    }
-    // location
-    void disable_locationTracing() {
-        locationManager.removeUpdates(locationListener);
-    }
-
-
-    void enable_locationTracing(int timeInterval, int distance ) {
-
-        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
-            //    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;
-        }
-
-
-        locationManager.requestLocationUpdates(
-                "fused", timeInterval, distance,
-                locationListener);
-//        if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
-//
-//
-//
-//
-//        } else if (locationManager
-//                .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
-//
-//
-//            locationManager.requestLocationUpdates(
-//                    LocationManager.NETWORK_PROVIDER, timeInterval, distance,
-//                    locationListener);
-//
-//        }
-    }
-
-    protected Location request_cachedlocation()
-    {
-        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
-
-            return null;
-        }
-
-
-
-        //使用GPS获取上一次的地址,这样获取到的信息需要多次,才能够显示出来,所以后面有动态的判断
-        Location location = locationManager.getLastKnownLocation("fused");
-        return location;
-
-    }
-    protected void request_location(final String receiverID)
-    {
-        if(receiverID==null)
-            throw new IllegalArgumentException("receiverID can't be null");
-
-//        Criteria criteria = new Criteria();
-//        criteria.setAccuracy(Criteria.ACCURACY_COARSE);//低精度,如果设置为高精度,依然获取不了location。
-//        criteria.setAltitudeRequired(false);//不要求海拔
-//        criteria.setBearingRequired(false);//不要求方位
-//        criteria.setCostAllowed(true);//允许有花费
-//        criteria.setPowerRequirement(Criteria.POWER_LOW);//低功耗
-//
-//        //从可用的位置提供器中,匹配以上标准的最佳提供器
-//        String locationProvider = locationManager.getBestProvider(criteria, true);
-
-
-        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
-            //    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 ;
-        }
-
-        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);
-
-
-    }
-}

+ 162 - 165
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/service/RAService.java

@@ -14,7 +14,6 @@ import android.content.pm.PackageManager;
 import android.location.Location;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
-import android.os.AsyncTask;
 import android.os.Binder;
 import android.os.Build;
 import android.os.Bundle;
@@ -36,11 +35,9 @@ 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;
 import org.json.JSONObject;
 
 import java.util.ArrayList;
@@ -205,170 +202,170 @@ public abstract class RAService extends Service {
     }
 
     private ServicePushNotification pushNotificationCallback = null;
-    private checkPushTask m_task = null;
-
-    class checkPushTask extends AsyncTask<Void, Void, Boolean> {
-        int errorcode;
-        String content = null;
-        Context mcontext;
-
-        public checkPushTask(Context context) {
-            mcontext = context;
-        }
-
-        @Override
-        protected Boolean doInBackground(Void... params) {
-            Log.d("SearchTask", "doInBackground");
-
-            if (!Network.isNetworkAvailable(getApplication()))
-
-            {
-                errorcode = Network.RESULT_NET_NOTAVAILABLE;
-                return false;
-            }
-            String jstr = "";
-            jstr = Network.check_push(mcontext, new Bundle(), url_checknotification);
-            // if (module_name.equals("Announcements"))
-            // jstr = Network.get_announcements(lastid, limit);
-            // else
-            // jstr = Network.get_marketnews(lastid, limit);
-            if (jstr == null || jstr.length() <= 0) {
-                // Log.d(TAG, "json is wrong");
-
-                errorcode = Network.RESULT_NET_ERROR;
-                return false;
-            }
-
-            content = jstr;
-            return true;
-        }
-
-        @Override
-        protected void onPostExecute(Boolean success) {
-            String tag = "onPostExec";
-            Log.i(tag, "entry");
-            m_task = null;
-
-
-            if (success) {
-                JSONObject jsobj;
-                //
-                // array = new JSONArray(json);
-                try {
-                    jsobj = new JSONObject(content);
-
-                    int count = jsobj.getInt("count");
-
-                    for (int i = 0; i < count; i++) {
-                        JSONObject msg = jsobj.getJSONObject("msg_" + i);
-                        int type = msg.getInt("type");
-                        if (type == NOTIFICATION_TYPE_SILENCECOMMAND) {
-
-                            pushNotificationCallback.handleSilenceMessage(msg);
-                            Intent intent = new Intent(RABroadcast.EVENT_SILENCECOMMAND);
-                            intent.putExtra("msg", msg.toString());
-                            sendBroadcast(intent);
-
-                        } else {
-                            pushNotification(msg);
-
-                            Intent intent = new Intent(RABroadcast.EVENT_PUSHNOTIFICATION);
-                            intent.putExtra("msg", msg.toString());
-                            sendBroadcast(intent);
-
-
-                        }
-                    }
-
-
-                } catch (JSONException e) {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
-                }
-
-            }
-
-            super.onPostExecute(success);
-        }
-
-        @Override
-        protected void onCancelled() {
-            m_task = null;
-            // showProgress(false);
-        }
-    }
-
-
-    public void pushNotification(JSONObject msg) {
-
-        if (enable_pushNotification) {
-
-            boolean bsound = true;
-//                    mcontext.getSharedPreferences(
-//                    "setting", 0).getBoolean(
-//                    "notifications_new_message_sound", true);
-            boolean bvibrate = true;
-//            mcontext.getSharedPreferences(
-//                    "setting", 0).getBoolean(
-//                    "notifications_new_message_vibrate", true);
-            NotificationManager nManager = (NotificationManager)
-                    getSystemService(Context.NOTIFICATION_SERVICE);
-
-/*
-       此部分在虚函数 prepareNotificaiton 中实现
-            Intent intent = new Intent(mcontext,
-                    FunctionSelectActivity.class);
-            intent.putExtra("launcher", "notification");
-
-            PendingIntent pintent = PendingIntent.getActivity(
-                    this, 0, intent,
-                    PendingIntent.FLAG_UPDATE_CURRENT);
-
-
-            Notification.Builder builder = new Notification.Builder(mcontext);//新建Notification.Builder对象
-            String ntitle = "";
-            int number = ApexTrackingApplication.ncount++;
-            if (number > 1)
-                ntitle=number
-                        + " "
-                        + ApexTrackingApplication
-                        .get_instance()
-                        .getString(
-                                R.string.str_mnotification_title);
-            else
-                ntitle = ApexTrackingApplication
-                        .get_instance()
-                        .getString(
-                                R.string.str_notification_title);
-
-            builder.setContentTitle(ntitle);//设置标题
-            builder.setContentText(ApexTrackingApplication
-                    .get_instance()
-                    .getString(
-                            R.string.str_notification_text)
-                    + date);//设置内容
-            builder.setSmallIcon(R.drawable.ic_launcher);//设置图片
-            builder.setContentIntent(pintent);//执行intent
+//    private checkPushTask m_task = null;
 
+//    class checkPushTask extends AsyncTask<Void, Void, Boolean> {
+//        int errorcode;
+//        String content = null;
+//        Context mcontext;
+//
+//        public checkPushTask(Context context) {
+//            mcontext = context;
+//        }
+//
+//        @Override
+//        protected Boolean doInBackground(Void... params) {
+//            Log.d("SearchTask", "doInBackground");
+//
+//            if (!Network.isNetworkAvailable(getApplication()))
+//
+//            {
+//                errorcode = Network.RESULT_NET_NOTAVAILABLE;
+//                return false;
+//            }
+//            String jstr = "";
+//            jstr = Network.check_push(mcontext, new Bundle(), url_checknotification);
+//            // if (module_name.equals("Announcements"))
+//            // jstr = Network.get_announcements(lastid, limit);
+//            // else
+//            // jstr = Network.get_marketnews(lastid, limit);
+//            if (jstr == null || jstr.length() <= 0) {
+//                // Log.d(TAG, "json is wrong");
+//
+//                errorcode = Network.RESULT_NET_ERROR;
+//                return false;
+//            }
+//
+//            content = jstr;
+//            return true;
+//        }
+//
+//        @Override
+//        protected void onPostExecute(Boolean success) {
+//            String tag = "onPostExec";
+//            Log.i(tag, "entry");
+//            m_task = null;
+//
+//
+//            if (success) {
+//                JSONObject jsobj;
+//                //
+//                // array = new JSONArray(json);
+//                try {
+//                    jsobj = new JSONObject(content);
+//
+//                    int count = jsobj.getInt("count");
+//
+//                    for (int i = 0; i < count; i++) {
+//                        JSONObject msg = jsobj.getJSONObject("msg_" + i);
+//                        int type = msg.getInt("type");
+//                        if (type == NOTIFICATION_TYPE_SILENCECOMMAND) {
+//
+//                            pushNotificationCallback.handleSilenceMessage(msg);
+//                            Intent intent = new Intent(RABroadcast.EVENT_SILENCECOMMAND);
+//                            intent.putExtra("msg", msg.toString());
+//                            sendBroadcast(intent);
+//
+//                        } else {
+//                            pushNotification(msg);
+//
+//                            Intent intent = new Intent(RABroadcast.EVENT_PUSHNOTIFICATION);
+//                            intent.putExtra("msg", msg.toString());
+//                            sendBroadcast(intent);
+//
+//
+//                        }
+//                    }
+//
+//
+//                } catch (JSONException e) {
+//                    // TODO Auto-generated catch block
+//                    e.printStackTrace();
+//                }
+//
+//            }
+//
+//            super.onPostExecute(success);
+//        }
+//
+//        @Override
+//        protected void onCancelled() {
+//            m_task = null;
+//            // showProgress(false);
+//        }
+//    }
+//
 
-            */
-            Notification notification = pushNotificationCallback.prepareNotification(msg);//builder.getNotification();//将builder对象转换为普通的notifications
-            notification.defaults = Notification.DEFAULT_ALL;
-
-//            if (bsound && bvibrate)
-//                notification.defaults = Notification.DEFAULT_ALL;
-//            else if (bsound)
-//                notification.defaults = Notification.DEFAULT_SOUND
-//                        | Notification.DEFAULT_LIGHTS;
-//            else if (bvibrate)
-//                notification.defaults = Notification.DEFAULT_VIBRATE
-//                        | Notification.DEFAULT_LIGHTS;
-            notification.flags = Notification.FLAG_AUTO_CANCEL;
-//            notification.number = number; //number 是不是不需要了?
-
-            nManager.notify(R.layout.support_simple_spinner_dropdown_item, notification);
-        }
-    }
+//    public void pushNotification(JSONObject msg) {
+//
+//        if (enable_pushNotification) {
+//
+//            boolean bsound = true;
+////                    mcontext.getSharedPreferences(
+////                    "setting", 0).getBoolean(
+////                    "notifications_new_message_sound", true);
+//            boolean bvibrate = true;
+////            mcontext.getSharedPreferences(
+////                    "setting", 0).getBoolean(
+////                    "notifications_new_message_vibrate", true);
+//            NotificationManager nManager = (NotificationManager)
+//                    getSystemService(Context.NOTIFICATION_SERVICE);
+//
+///*
+//       此部分在虚函数 prepareNotificaiton 中实现
+//            Intent intent = new Intent(mcontext,
+//                    FunctionSelectActivity.class);
+//            intent.putExtra("launcher", "notification");
+//
+//            PendingIntent pintent = PendingIntent.getActivity(
+//                    this, 0, intent,
+//                    PendingIntent.FLAG_UPDATE_CURRENT);
+//
+//
+//            Notification.Builder builder = new Notification.Builder(mcontext);//新建Notification.Builder对象
+//            String ntitle = "";
+//            int number = ApexTrackingApplication.ncount++;
+//            if (number > 1)
+//                ntitle=number
+//                        + " "
+//                        + ApexTrackingApplication
+//                        .get_instance()
+//                        .getString(
+//                                R.string.str_mnotification_title);
+//            else
+//                ntitle = ApexTrackingApplication
+//                        .get_instance()
+//                        .getString(
+//                                R.string.str_notification_title);
+//
+//            builder.setContentTitle(ntitle);//设置标题
+//            builder.setContentText(ApexTrackingApplication
+//                    .get_instance()
+//                    .getString(
+//                            R.string.str_notification_text)
+//                    + date);//设置内容
+//            builder.setSmallIcon(R.drawable.ic_launcher);//设置图片
+//            builder.setContentIntent(pintent);//执行intent
+//
+//
+//            */
+//            Notification notification = pushNotificationCallback.prepareNotification(msg);//builder.getNotification();//将builder对象转换为普通的notifications
+//            notification.defaults = Notification.DEFAULT_ALL;
+//
+////            if (bsound && bvibrate)
+////                notification.defaults = Notification.DEFAULT_ALL;
+////            else if (bsound)
+////                notification.defaults = Notification.DEFAULT_SOUND
+////                        | Notification.DEFAULT_LIGHTS;
+////            else if (bvibrate)
+////                notification.defaults = Notification.DEFAULT_VIBRATE
+////                        | Notification.DEFAULT_LIGHTS;
+//            notification.flags = Notification.FLAG_AUTO_CANCEL;
+////            notification.number = number; //number 是不是不需要了?
+//
+//            nManager.notify(R.layout.support_simple_spinner_dropdown_item, notification);
+//        }
+//    }
 
 //
 

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

@@ -353,7 +353,7 @@ public class RAUploadManager {
 
                 if (file.exists() && taskinfo.getInt("status") == TaskStatus.TaskStatusFinish.ordinal() && taskinfo.getString("msg").indexOf("warning:") < 0) {
                     String filepath = file.getAbsolutePath();
-                    file.delete();
+                    boolean delresult=file.delete();
                     ImageUtil.updateGallery(applicationContext,filepath);
                 }
                 ///////////////////////////////////////////////
@@ -437,11 +437,11 @@ public class RAUploadManager {
                 ObjectInputStream ois = null;
 
                 ois = new ObjectInputStream(bais);
-
-                ArrayList<String> arr_load = (ArrayList<String>) ois.readObject();
-                for (String s : arr_load) {
+                Object obj = ois.readObject();
+                ArrayList<?> arr_load = (ArrayList<?>) obj;
+                for (Object s : arr_load) {
                     Log.d("_RAIMAGE", "loadTask: " + s);
-                    JSONObject jsobj = new JSONObject(s);
+                    JSONObject jsobj = new JSONObject((String)s);
                     Bundle b = RAUtil.Json2Bundle(jsobj);
                     arr_queue.add(b);
 //                                String sjson=RAUtil.Bundle2Json(b).toString();
@@ -537,7 +537,7 @@ public class RAUploadManager {
             iconntype = networkInfo
                     .getType();
 
-            if (wifiOnly == true
+            if (wifiOnly
                     && iconntype !=
                     ConnectivityManager.TYPE_WIFI
                     && iconntype !=
@@ -597,7 +597,7 @@ public class RAUploadManager {
             //只有finish的task 可以删除图片
             if (file.exists() && task.getInt("status") == TaskStatus.TaskStatusFinish.ordinal()) {
                 String filepath = file.getAbsolutePath();
-                file.delete();
+                boolean bdelete=file.delete();
                 ImageUtil.updateGallery(applicationContext,filepath);
             }
 
@@ -625,7 +625,7 @@ public class RAUploadManager {
                 File file = new File(path);
                 if (file.exists() && task.getInt("status") == TaskStatus.TaskStatusFinish.ordinal()) {
                     String filepath = file.getAbsolutePath();
-                    file.delete();
+                    boolean bdelete=file.delete();
                     ImageUtil.updateGallery(applicationContext,filepath);
                 }
             }
@@ -728,7 +728,7 @@ public class RAUploadManager {
 
     }
 
-    ;
+
 
 
     private String filePath(Bundle task) {

+ 1 - 1
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/CrashHandler.java

@@ -74,7 +74,7 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler{
     private String getDeviceInfo() {
         try {
             PackageManager pm = ctx.getPackageManager();
-            PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), PackageManager.GET_ACTIVITIES);
+            PackageInfo pi = pm.getPackageInfo(ctx.getApplicationContext().getPackageName(), PackageManager.GET_ACTIVITIES);
             String appVer = "App Version: " + pi.versionName + "_" + pi.versionCode + "\n";
             String osVer = "OS Version: " + Build.VERSION.RELEASE + "_" + Build.VERSION.SDK_INT + "\n";
             String manufacture = "Manufacturer: " + Build.MANUFACTURER + "\n";

+ 0 - 5
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/ImageUtil.java

@@ -10,20 +10,15 @@ import android.graphics.drawable.Drawable;
 import android.media.ExifInterface;
 import android.media.MediaScannerConnection;
 import android.net.Uri;
-import android.os.Build;
-import android.support.v4.content.FileProvider;
 import android.support.v4.graphics.drawable.DrawableCompat;
 import android.util.Log;
 
 import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URI;
-import java.net.URL;
 
 public class ImageUtil {
 

+ 44 - 45
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/utils/RAUtil.java

@@ -1,6 +1,5 @@
 package com.usai.redant.rautils.utils;
 
-import android.Manifest;
 import android.app.Activity;
 import android.app.Application;
 import android.content.Context;
@@ -12,7 +11,6 @@ import android.os.Bundle;
 import android.provider.Settings;
 import android.support.v4.app.ActivityCompat;
 import android.support.v4.content.PermissionChecker;
-import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -29,7 +27,6 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class RAUtil {
@@ -304,35 +301,36 @@ public class RAUtil {
 
     public static String getDUID(Application application) {
 
-        if (application == null) {
-            return null;
-        }
-
-        final TelephonyManager tm = (TelephonyManager) application.getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
-        final String tmDevice, tmSerial, androidId;
-        String uniqueId;
-        try {
-            if (ActivityCompat.checkSelfPermission(application, Manifest.permission.READ_PHONE_STATE) != 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 null;
-            }
-            tmDevice = "" + tm.getDeviceId();
-            tmSerial = "" + tm.getSimSerialNumber();
-            androidId = "" + android.provider.Settings.Secure.getString(application.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
-            UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
-            uniqueId = deviceUuid.toString();
-            Log.d("debug", "uuid=" + uniqueId);
-
-        } catch (Exception e) {
-            uniqueId = null;
-        }
-        return uniqueId;
+        return getAndroidId(application.getApplicationContext());
+//        if (application == null) {
+//            return null;
+//        }
+//
+//        final TelephonyManager tm = (TelephonyManager) application.getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
+//        final String tmDevice, tmSerial, androidId;
+//        String uniqueId;
+//        try {
+//            if (ActivityCompat.checkSelfPermission(application, Manifest.permission.READ_PHONE_STATE) != 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 null;
+//            }
+//            tmDevice = "" + tm.getDeviceId();
+//            tmSerial = "" + tm.getSimSerialNumber();
+//            androidId = "" + android.provider.Settings.Secure.getString(application.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
+//            UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
+//            uniqueId = deviceUuid.toString();
+//            Log.d("debug", "uuid=" + uniqueId);
+//
+//        } catch (Exception e) {
+//            uniqueId = null;
+//        }
+//        return uniqueId;
     }
 
     public static int px2dp(Context context, float pxValue) {
@@ -357,19 +355,20 @@ public class RAUtil {
 
 
     public static String getDeviceId(Context context) {
-        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
-        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != 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 "";
-        }
-        String deviceId = telephonyManager.getDeviceId().toString();
-        return deviceId;
+        return getAndroidId(context);
+//        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+//        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != 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 "";
+//        }
+//        String deviceId = telephonyManager.getDeviceId().toString();
+//        return deviceId;
     }
     public static String getAndroidId(Context context) {
         return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);

+ 1 - 1
ApexDrivers/settings.gradle

@@ -1 +1 @@
-include ':app', ':apexdriverscn', ':apexdriversi' ,':RAUtilsLibrary'
+include ':apexdriverslib', ':apexdriverscn', ':apexdriversi' ,':RAUtilsLibrary'