|
|
@@ -3,6 +3,7 @@ package com.usai.redant.apexdrivers;
|
|
|
|
|
|
import android.Manifest;
|
|
|
import android.app.AlertDialog;
|
|
|
+import android.app.NotificationManager;
|
|
|
import android.app.ProgressDialog;
|
|
|
import android.content.ComponentName;
|
|
|
import android.content.Context;
|
|
|
@@ -22,6 +23,7 @@ import android.support.v4.app.ActivityCompat;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
import android.support.v4.app.FragmentManager;
|
|
|
import android.support.v4.app.FragmentTransaction;
|
|
|
+import android.support.v4.app.NotificationManagerCompat;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.Menu;
|
|
|
@@ -165,8 +167,9 @@ public class MainActivity extends BasicActivity implements LoginFragment.LoginCa
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+ checkNotificationEnable();
|
|
|
}
|
|
|
|
|
|
void checkPowerManagement()
|
|
|
@@ -260,8 +263,9 @@ public class MainActivity extends BasicActivity implements LoginFragment.LoginCa
|
|
|
// Manifest.permission.ACCESS_WIFI_STATE,
|
|
|
Manifest.permission.INTERNET,
|
|
|
Manifest.permission.ACCESS_FINE_LOCATION,
|
|
|
+ Manifest.permission.ACCESS_COARSE_LOCATION
|
|
|
//
|
|
|
- Manifest.permission.CHANGE_CONFIGURATION
|
|
|
+// Manifest.permission.CHANGE_CONFIGURATION
|
|
|
|
|
|
|
|
|
|
|
|
@@ -270,6 +274,32 @@ public class MainActivity extends BasicActivity implements LoginFragment.LoginCa
|
|
|
RAUtil.checkPermissions(this,permissions);
|
|
|
}
|
|
|
|
|
|
+ private void checkNotificationEnable() {
|
|
|
+
|
|
|
+ boolean enable = NotificationManagerCompat.from(getApplicationContext()).areNotificationsEnabled();
|
|
|
+ if (!enable) {
|
|
|
+
|
|
|
+ new AlertDialog.Builder(this)
|
|
|
+ .setTitle("Warning")
|
|
|
+ .setMessage("you should enable notification")
|
|
|
+ .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ openSystemSetting();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .show();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void openSystemSetting() {
|
|
|
+ Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
+ intent.setData(Uri.parse("package:" + getPackageName()));
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
+
|
|
|
private void restart() {
|
|
|
|
|
|
finish();
|