Sfoglia il codice sorgente

Apex&Drivers 增加alarmreceiver 并修改基类

Ray Zhang 7 anni fa
parent
commit
a471ab6a95

+ 281 - 0
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/Receiver/AlarmReceiver.java

@@ -0,0 +1,281 @@
+package com.usai.redant.rautils.Receiver;
+
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+public abstract class AlarmReceiver extends BootCompleteBroadcastReceiver {
+    protected  int alarm_timeInterval = 30 * 1000;
+
+//    protected static final int	SO_TIMEOUT						= 15 * 1000;
+
+    protected abstract void InitAlarm(Context context, Intent intent);
+    protected abstract void AlarmProc(Context context, Intent intent);
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+
+        super.onReceive(context,intent);
+
+        String action = intent
+                .getAction();
+
+        Log.d("AlarmReceiver", "onReceive: " + action);
+
+        if (RABroadcast.ACTION_REDANT_INIT_ALARM.equals(intent.getAction())) {
+            InitAlarm(context,intent);
+        }
+        else
+        if (RABroadcast.ACTION_REDANT_ALARM.equals(intent.getAction())) {
+
+
+            AlarmProc(context,intent);
+
+        }
+//        else
+//        if (Intent.ACTION_LOCKED_BOOT_COMPLETED.equals(intent.getAction())) {
+//
+//            InitAlarm(context,intent);
+//        }
+
+
+/*
+
+?????
+
+        Intent iAlarm = new Intent(context, AlarmReceiver.class);
+//        iAlarm.putExtra("caller", caller);
+        iAlarm.setAction("ACTION_PUSHNOTIFICATION_CHECK");
+        PendingIntent sender = PendingIntent.getBroadcast(context, 0,
+                iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
+
+
+        AlarmManager am = (AlarmManager) context.getSystemService(
+                Context.ALARM_SERVICE);
+//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+//            am.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + pushcheck_timeInterval, sender);
+//        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+//            am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + pushcheck_timeInterval, sender);
+//        }
+
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            am.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + alarm_timeInterval, sender);
+        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + alarm_timeInterval, sender);
+        }
+
+*/
+    }
+
+
+    @Override
+    protected void OnBootComplete(Context context, Intent intent) {
+
+        Log.d("AlarmReceiver", "OnBootComplete: SEND" + RABroadcast.ACTION_REDANT_INIT_ALARM);
+        Intent bintent = new Intent(RABroadcast.ACTION_REDANT_INIT_ALARM);
+//        bintent.putExtra("msg", msg.toString());
+
+        bintent.setClass(context, this.getClass());
+        context.sendBroadcast(bintent);
+
+    }
+
+    @Override
+    protected void OnLockedBootComplete(Context context, Intent intent) {
+
+        Log.d("AlarmReceiver", "OnLockedBootComplete: SEND" + RABroadcast.ACTION_REDANT_INIT_ALARM);
+
+        Log.d("AlarmReceiver", "OnLockedBootComplete: class" + this.getClass());
+        Intent bintent = new Intent(RABroadcast.ACTION_REDANT_INIT_ALARM);
+//        bintent.putExtra("msg", msg.toString());
+
+
+        bintent.setClass(context, this.getClass());
+        context.sendBroadcast(bintent);
+    }
+
+/*
+
+    private 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;
+    }
+
+    private void check_push(Context context)
+    {
+
+
+        String dev_id = getDeviceId(context);
+        Log.d("AlarmReceiver", "check_push: "+dev_id);
+
+
+
+        new Thread(new Runnable() {
+            @Override
+            public void run() {
+                logout();
+
+//                runOnUiThread(new Runnable() {
+//                    @Override
+//                    public void run() {
+//                        dismissProgressDialog();
+//                        ApexDriverApplication.sharedApplication().logout();
+//                        showLogin();
+//                    }
+//                });
+            }
+        }).start();
+//        return dev_id;
+    }
+
+
+
+
+    private  String getJson(String url, Bundle parms)
+    {
+        String TAG = "net_dbg@GetJson";
+        Log.d(TAG, "entry");
+        String ret=null;
+
+        HttpURLConnection connection = null;
+
+        try {
+
+
+            URL _url;
+            _url = new URL(url);
+            connection = (HttpURLConnection) _url.openConnection();
+            connection.setReadTimeout(SO_TIMEOUT);
+            connection.setConnectTimeout(SO_TIMEOUT);
+            // 设置请求方式
+            connection.setRequestMethod("POST");
+            // 设置编码格式
+            connection.setRequestProperty("Charset", "UTF-8");
+            // 传递自定义参数
+//			connection.setRequestProperty("MyProperty", "this is me!");
+
+            Set<String> keys = parms.keySet();
+            Log.d(TAG, "================parms============");
+            for (String key : keys)
+            {
+                if (key.contains("_file"))
+                {
+
+                }
+                else
+                {
+                    Log.d(TAG, "key=" + key + "    val=" + parms.get(key).toString());
+                }
+
+            }
+            Log.d(TAG, "================parms============");
+
+            Log.d(TAG,"URL: "+url);
+            // 设置容许输出
+            connection.setDoInput(true);
+            connection.setDoOutput(true);
+
+
+            OutputStream os = connection.getOutputStream();
+            BufferedWriter writer = new BufferedWriter(
+                    new OutputStreamWriter(os, "UTF-8"));
+            writer.write(createPostParameters(parms));
+
+            writer.flush();
+            writer.close();
+            os.close();
+
+            // 获取返回数据
+            if(connection.getResponseCode() == 200){
+                InputStream is = connection.getInputStream();
+
+                BufferedReader br = new BufferedReader(
+                        new InputStreamReader(is, "utf-8"), 8);
+                StringBuilder sb = new StringBuilder();
+                String line = null;
+                while ((line = br.readLine()) != null)
+                {
+                    sb.append(line + "\n");
+                }
+
+                Log.d(TAG, "Response: content begin");
+                Log.d(TAG, sb.toString());
+                Log.d(TAG, "Response: content end");
+
+                if (sb.length() <= 0)
+                {
+
+                    ret= null;
+                }
+                ret= sb.toString();
+
+            }
+
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+
+            Log.e(TAG, e.toString());
+
+        } catch (ProtocolException e) {
+            e.printStackTrace();
+
+            Log.e(TAG, e.toString());
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+
+            Log.e(TAG, e.toString());
+
+        } catch (IOException e) {
+            e.printStackTrace();
+
+            Log.e(TAG, e.toString());
+
+        } finally {
+
+            if(connection!=null){
+                connection.disconnect();
+            }
+        }
+        return ret;
+    }
+    private  String createPostParameters(Bundle parms) throws UnsupportedEncodingException {
+        StringBuilder result = new StringBuilder();
+        boolean first = true;
+        for(String key : parms.keySet()){
+            if (first)
+                first = false;
+            else
+                result.append("&");
+
+            result.append(URLEncoder.encode(key, "UTF-8"));
+            result.append("=");
+            result.append(URLEncoder.encode(parms.get(key).toString(), "UTF-8"));
+        }
+
+        return result.toString();
+    }
+    private static final String URL_HOST = "http://192.168.0.124:8080";
+    public static final String URL_LOGOUT = URL_HOST + "/j/mobile/loginOut.mo/";
+    public  void logout() {
+
+
+        Bundle params = new Bundle();
+        params.putString("platform","android");
+
+        getJson(URL_LOGOUT,params);
+    }
+
+    */
+}

+ 4 - 0
ApexDrivers/RAUtilsLibrary/src/main/java/com/usai/redant/rautils/Receiver/RABroadcast.java

@@ -11,6 +11,10 @@ public class RABroadcast {
     public static String ACTION_LOCATION_REQUEST_LOCATION="REDANT.BROADCAST.ACTION_LOCATION_REQUEST_LOCATION";
     public static String ACTION_PUSHNOTIFICATION_CHECK="REDANT.BROADCAST.ACTION_PUSHNOTIFICATION_CHECK";
 
+
+    public static String ACTION_REDANT_ALARM="REDANT.BROADCAST.ACTION_REDANT_ALARM";
+    public static String ACTION_REDANT_INIT_ALARM="REDANT.BROADCAST.ACTION_REDANT_INIT_ALARM";
+
     public static String ACTION_PUSHNOTIFICATION_ENABLE_CHECK="REDANT.BROADCAST.ACTION_PUSHNOTIFICATION_ENABLE_CHECK";
     public static String ACTION_PUSHNOTIFICATION_DISABLE_CHECK="REDANT.BROADCAST.ACTION_PUSHNOTIFICATION_DISABLE_CHECK";
 

+ 55 - 45
ApexDrivers/app/src/main/AndroidManifest.xml

@@ -1,25 +1,32 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.usai.redant.apexdrivers">
+    package="com.usai.redant.apexdrivers">
 
     <!-- External storage for log and cache. -->
     <!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> -->
     <!-- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> -->
 
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.FLASHLIGHT" />
 
-    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
 
-    <uses-permission android:name="android.permission.CAMERA"/>
-    <uses-permission android:name="android.permission.WAKE_LOCK"/>
-    <uses-permission android:name="android.permission.VIBRATE"/>
-    <uses-permission android:name="android.permission.FLASHLIGHT"/>
+
+    <uses-permission android:name="android.alarm.permission.SET_ALARM"/>
+
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+
+    <uses-permission android:name="android.permission.INTERNET"/>
+
     <!-- 调用硬件相机权限 -->
-    <uses-feature android:name="android.hardware.camera"/>
-    <uses-feature android:name="android.hardware.camera.autofocus"/>
+    <uses-feature android:name="android.hardware.camera" />
+    <uses-feature android:name="android.hardware.camera.autofocus" />
     <!-- 文件读写权限 -->
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 
     <application
         android:name=".ApexDriverApplication"
@@ -36,8 +43,7 @@
             android:grantUriPermissions="true">
             <meta-data
                 android:name="android.support.FILE_PROVIDER_PATHS"
-                android:resource="@xml/download_dir">
-            </meta-data>
+                android:resource="@xml/download_dir"></meta-data>
         </provider>
 
         <activity
@@ -45,23 +51,22 @@
             android:launchMode="singleTop"
             android:screenOrientation="portrait">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
+                <action android:name="android.intent.action.MAIN" />
 
-                <category android:name="android.intent.category.LAUNCHER"/>
+                <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
 
         <service
             android:name=".ApexDriversBackgroundService"
-            android:label="ApexDrivers background service"
             android:enabled="true"
+            android:exported="true"
+            android:label="ApexDrivers background service">
 
-            android:exported="true">
-        <!--<intent-filter>-->
-            <!--<action android:name="com.usai.redant.apexdrivers.ApexDriversBackgroundService"/>-->
-        <!--</intent-filter>-->
-    </service>
-
+            <!-- <intent-filter> -->
+            <!-- <action android:name="com.usai.redant.apexdrivers.ApexDriversBackgroundService"/> -->
+            <!-- </intent-filter> -->
+        </service>
 
         <receiver
             android:name=".Receiver.ApexDriverBootCompleteReceiver"
@@ -70,23 +75,20 @@
             android:exported="false"
             android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
             <intent-filter>
-                <action android:name="android.intent.action.BOOT_COMPLETED"/>
-                <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"/>
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
             </intent-filter>
         </receiver>
 
         <activity
             android:name=".Detail.DetailActivity"
-            android:screenOrientation="portrait">
-        </activity>
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".Update.UpdateActivity"
-            android:screenOrientation="portrait">
-        </activity>
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".camera.PreferencesActivity"
-            android:screenOrientation="portrait">
-        </activity>
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".CodeScanner.CaptureActivity"
             android:clearTaskOnLaunch="true"
@@ -94,32 +96,40 @@
             android:screenOrientation="sensorLandscape"
             android:stateNotNeeded="true"
             android:theme="@style/CaptureTheme"
-            android:windowSoftInputMode="stateAlwaysHidden">
-        </activity>
+            android:windowSoftInputMode="stateAlwaysHidden"></activity>
         <activity
             android:name=".Update.PhotoPreviewActivity"
-            android:screenOrientation="portrait">
-        </activity>
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".Login.RetrievePasswordActivity"
-            android:screenOrientation="portrait">
-        </activity>
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".Home.HomeMoreActivity"
-            android:screenOrientation="portrait">
-        </activity>
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".Upload.UploadListActivity"
-            android:screenOrientation="portrait">
-        </activity>
+            android:screenOrientation="portrait"></activity>
         <activity
             android:name=".Upload.TaskActivity"
-            android:screenOrientation="portrait">
-        </activity>
-        <activity android:name=".Filter.OrderFilterActivity">
-        </activity>
-        <activity android:name=".Signature.SignatureActivity">
-        </activity>
+            android:screenOrientation="portrait"></activity>
+        <activity android:name=".Filter.OrderFilterActivity"></activity>
+        <activity android:name=".Signature.SignatureActivity"></activity>
+
+        <receiver
+            android:name=".Receiver.ApexDriverAlarmReceiver"
+            android:enabled="true"
+            android:exported="true"
+            android:directBootAware="true"
+            android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
+            >
+            <intent-filter>
+
+                <!--<action android:name="REDANT.BROADCAST.ACTION_REDANT_INIT_ALARM" />-->
+                <!--<action android:name="REDANT.BROADCAST.ACTION_REDANT_ALARM" />-->
+                <action android:name="android.intent.action.BOOT_COMPLETED" />
+                <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
+            </intent-filter>
+        </receiver>
         <activity android:name=".Message.MessageActivity">
         </activity>
         <activity android:name=".Setting.SettingActivity">

+ 46 - 24
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/ApexDriverApplication.java

@@ -9,8 +9,11 @@ import android.content.SharedPreferences;
 import android.location.Location;
 import android.os.Build;
 import android.os.IBinder;
+import android.util.Log;
 
+import com.usai.redant.apexdrivers.Receiver.ApexDriverAlarmReceiver;
 import com.usai.redant.apexdrivers.Utils.OperationQueue;
+import com.usai.redant.rautils.Receiver.RABroadcast;
 import com.usai.redant.rautils.Utils.AESUtil;
 
 public class ApexDriverApplication extends Application {
@@ -31,48 +34,67 @@ public class ApexDriverApplication extends Application {
 
     @Override
     public void onCreate() {
+        Log.d("ApexDriverApplication", "onCreate");
         super.onCreate();
 
         mApp = this;
 
-        user = savedUser();
-        password = savedPassword();
+        try {
+            user = savedUser();
+            password = savedPassword();
 
-        mServiceConnection = new ServiceConnection() {
-            @Override
-            public void onServiceConnected(ComponentName name, IBinder service) {
+            mServiceConnection = new ServiceConnection() {
+                @Override
+                public void onServiceConnected(ComponentName name, IBinder service) {
 
-                ApexDriversBackgroundService.MyBinder binder = (ApexDriversBackgroundService.MyBinder)service;
-                mService = (ApexDriversBackgroundService)binder.getService();
+                    ApexDriversBackgroundService.MyBinder binder = (ApexDriversBackgroundService.MyBinder)service;
+                    mService = (ApexDriversBackgroundService)binder.getService();
 
-            }
+                }
 
-            @Override
-            public void onServiceDisconnected(ComponentName name) {
+                @Override
+                public void onServiceDisconnected(ComponentName name) {
 
-                mService = null;
-            }
-        };
+                    mService = null;
+                }
+            };
 //
-        Intent serviceintent = new Intent();
-        serviceintent.setClass(this, ApexDriversBackgroundService.class);
+            Intent serviceintent = new Intent();
+            serviceintent.setClass(this, ApexDriversBackgroundService.class);
+
+            ComponentName cn ;
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+                cn =this.startForegroundService(serviceintent);
+            } else
+            {
+                cn =this.startService(serviceintent);
+            }
+
+
+            Intent intent = new Intent(getApplicationContext(),ApexDriversBackgroundService.class);
+            bindService(intent,mServiceConnection, Context.BIND_AUTO_CREATE);
 
-        ComponentName cn ;
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
-            cn =this.startForegroundService(serviceintent);
-        } else
+            networkQueue = new OperationQueue();
+
+
+        }catch (Exception e)
         {
-            cn =this.startService(serviceintent);
-        }
 
+        }
 
-        Intent intent = new Intent(getApplicationContext(),ApexDriversBackgroundService.class);
-        bindService(intent,mServiceConnection, Context.BIND_AUTO_CREATE);
 
-        networkQueue = new OperationQueue();
+        initAlarm();
 
     }
 
+    void initAlarm()
+    {
+        Log.d("ApexDriverApplication", "onCreate: SEND" + RABroadcast.ACTION_REDANT_INIT_ALARM);
+        Intent bintent = new Intent(RABroadcast.ACTION_REDANT_INIT_ALARM);
+        bintent.setClass(this, ApexDriverAlarmReceiver.class);
+//        bintent.putExtra("msg", msg.toString());
+        sendBroadcast(bintent);
+    }
 
     @Override
     public void onTerminate() {

+ 122 - 0
ApexDrivers/app/src/main/java/com/usai/redant/apexdrivers/Receiver/ApexDriverAlarmReceiver.java

@@ -0,0 +1,122 @@
+package com.usai.redant.apexdrivers.Receiver;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+import android.os.SystemClock;
+import android.util.Log;
+
+import com.usai.redant.rautils.Receiver.AlarmReceiver;
+import com.usai.redant.rautils.Receiver.RABroadcast;
+import com.usai.redant.rautils.Utils.RAUtil;
+
+public class ApexDriverAlarmReceiver extends AlarmReceiver {
+    protected  int alarm_timeInterval = 30 * 1000;
+
+    protected static final int	SO_TIMEOUT						= 15 * 1000;
+    @Override
+    protected void InitAlarm(Context context, Intent intent) {
+
+        Log.d("ApexDriverAlarmReceiver", "InitAlarm ");
+
+
+        // 启动完成
+
+        Intent iAlarm = new Intent(RABroadcast.ACTION_REDANT_ALARM);
+
+
+        iAlarm.setClass(context, ApexDriverAlarmReceiver.class);
+
+        PendingIntent sender = PendingIntent.getBroadcast(context, 0,
+                iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
+
+//        long firstime = SystemClock.elapsedRealtime();
+        AlarmManager am = (AlarmManager) context.getSystemService(
+                Context.ALARM_SERVICE);
+
+
+        if(am==null)
+            return;
+
+        am.cancel(sender);
+
+
+
+        Log.d("ApexDriverAlarmReceiver", "setup up alarm");
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            am.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), sender);
+        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), sender);
+        } else {
+            am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), alarm_timeInterval, sender);
+        }
+
+    }
+
+    @Override
+    protected void AlarmProc(Context context, Intent intent) {
+
+        Log.d("ApexDriverAlarmReceiver", "AlarmProc ");
+
+        check_push(context);
+
+
+        Intent iAlarm = new Intent(RABroadcast.ACTION_REDANT_ALARM);
+
+        iAlarm.setClass(context, ApexDriverAlarmReceiver.class);
+        PendingIntent sender = PendingIntent.getBroadcast(context, 0,
+                iAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
+
+
+        AlarmManager am = (AlarmManager) context.getSystemService(
+                Context.ALARM_SERVICE);
+        if(am==null)
+            return;
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            am.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + alarm_timeInterval, sender);
+        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+            am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + alarm_timeInterval, sender);
+        }
+    }
+
+//    @Override
+//    public void onReceive(Context context, Intent intent) {
+//        // TODO: This method is called when the BroadcastReceiver is receiving
+//        // an Intent broadcast.
+//        throw new UnsupportedOperationException("Not yet implemented");
+//    }
+
+
+
+    private void check_push(Context context)
+    {
+
+
+        String dev_id = RAUtil.getDeviceId(context);
+        Log.d("ApexDriverAlarmReceiver", "check_push: "+dev_id);
+
+
+        return ;
+//
+//        new Thread(new Runnable() {
+//            @Override
+//            public void run() {
+//                logout();
+//
+////                runOnUiThread(new Runnable() {
+////                    @Override
+////                    public void run() {
+////                        dismissProgressDialog();
+////                        ApexDriverApplication.sharedApplication().logout();
+////                        showLogin();
+////                    }
+////                });
+//            }
+//        }).start();
+////        return dev_id;
+    }
+
+
+}