Commit 01b49513 by cuiliang.shi

设置中定时版本

1 parent 29a62ad3
...@@ -6,8 +6,8 @@ android { ...@@ -6,8 +6,8 @@ android {
applicationId "com.agenew.location_server.application" applicationId "com.agenew.location_server.application"
minSdkVersion 26 minSdkVersion 26
targetSdkVersion 28 targetSdkVersion 28
versionCode 3 versionCode 4
versionName "1.2" versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
......
...@@ -10,8 +10,12 @@ public class AlarmReceiver extends BroadcastReceiver { ...@@ -10,8 +10,12 @@ public class AlarmReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.d("BirdService","receiver--"+System.currentTimeMillis()); Log.d("BirdService","receiver--"+System.currentTimeMillis());
Intent i = new Intent(context,BirdService.class); /* Intent i = new Intent(context,BirdService.class);
DevicePreferences.getInstance(context).putBoolean("is_need_notification", false); DevicePreferences.getInstance(context).putBoolean("is_need_notification", false);
context.startService(i); context.startService(i);*/
Intent intent2 = new Intent("com.bird.open_gps_alarm");
intent2.addFlags(0x01000000);
context.sendBroadcast(intent2);
} }
} }
...@@ -88,30 +88,30 @@ public class BirdService extends Service { ...@@ -88,30 +88,30 @@ public class BirdService extends Service {
// if (DevicePreferences.getInstance(this).getBoolean("is_need_notification", true)){ // if (DevicePreferences.getInstance(this).getBoolean("is_need_notification", true)){
String CHANNEL_ONE_ID = "com.primedu.cn"; // String CHANNEL_ONE_ID = "com.primedu.cn";
String CHANNEL_ONE_NAME = "Channel One"; // String CHANNEL_ONE_NAME = "Channel One";
NotificationChannel notificationChannel = null; // NotificationChannel notificationChannel = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
notificationChannel = new NotificationChannel(CHANNEL_ONE_ID, // notificationChannel = new NotificationChannel(CHANNEL_ONE_ID,
CHANNEL_ONE_NAME, NotificationManager.IMPORTANCE_HIGH); // CHANNEL_ONE_NAME, NotificationManager.IMPORTANCE_HIGH);
notificationChannel.enableLights(true); // notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED); // notificationChannel.setLightColor(Color.RED);
notificationChannel.setShowBadge(true); // notificationChannel.setShowBadge(true);
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); // notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.createNotificationChannel(notificationChannel); // manager.createNotificationChannel(notificationChannel);
} // }
//
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(), 0); // PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
Notification notification = null; // Notification notification = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
notification = new Notification.Builder(this).setChannelId(CHANNEL_ONE_ID) // notification = new Notification.Builder(this).setChannelId(CHANNEL_ONE_ID)
.setContentIntent(pendingIntent) // .setContentIntent(pendingIntent)
.getNotification(); // .getNotification();
} // }
notification.flags |= Notification.FLAG_NO_CLEAR; // notification.flags |= Notification.FLAG_NO_CLEAR;
startForeground(1, notification); // startForeground(1, notification);
//
// }else{ // }else{
// DevicePreferences.getInstance(this).putBoolean("is_need_notification", true); // DevicePreferences.getInstance(this).putBoolean("is_need_notification", true);
...@@ -143,7 +143,7 @@ public class BirdService extends Service { ...@@ -143,7 +143,7 @@ public class BirdService extends Service {
+ ", amapLocation.getAccuracy():"+amapLocation.getAccuracy() + ", amapLocation.getAccuracy():"+amapLocation.getAccuracy()
+"amapLocation.getLocationType()" + amapLocation.getLocationType()); +"amapLocation.getLocationType()" + amapLocation.getLocationType());
if (mLocationCount > 5){ if (mLocationCount > 3){
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mStartTime = dateformat.format(System.currentTimeMillis()); mStartTime = dateformat.format(System.currentTimeMillis());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!