Commit 01b49513 by cuiliang.shi

设置中定时版本

1 parent 29a62ad3
......@@ -6,8 +6,8 @@ android {
applicationId "com.agenew.location_server.application"
minSdkVersion 26
targetSdkVersion 28
versionCode 3
versionName "1.2"
versionCode 4
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
......
......@@ -10,8 +10,12 @@ public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
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);
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 {
// if (DevicePreferences.getInstance(this).getBoolean("is_need_notification", true)){
String CHANNEL_ONE_ID = "com.primedu.cn";
String CHANNEL_ONE_NAME = "Channel One";
NotificationChannel notificationChannel = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
notificationChannel = new NotificationChannel(CHANNEL_ONE_ID,
CHANNEL_ONE_NAME, NotificationManager.IMPORTANCE_HIGH);
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED);
notificationChannel.setShowBadge(true);
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
manager.createNotificationChannel(notificationChannel);
}
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
Notification notification = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
notification = new Notification.Builder(this).setChannelId(CHANNEL_ONE_ID)
.setContentIntent(pendingIntent)
.getNotification();
}
notification.flags |= Notification.FLAG_NO_CLEAR;
startForeground(1, notification);
// String CHANNEL_ONE_ID = "com.primedu.cn";
// String CHANNEL_ONE_NAME = "Channel One";
// NotificationChannel notificationChannel = null;
// if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
// notificationChannel = new NotificationChannel(CHANNEL_ONE_ID,
// CHANNEL_ONE_NAME, NotificationManager.IMPORTANCE_HIGH);
// notificationChannel.enableLights(true);
// notificationChannel.setLightColor(Color.RED);
// notificationChannel.setShowBadge(true);
// notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
// NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// manager.createNotificationChannel(notificationChannel);
// }
//
// PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
// Notification notification = null;
// if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
// notification = new Notification.Builder(this).setChannelId(CHANNEL_ONE_ID)
// .setContentIntent(pendingIntent)
// .getNotification();
// }
// notification.flags |= Notification.FLAG_NO_CLEAR;
// startForeground(1, notification);
//
// }else{
// DevicePreferences.getInstance(this).putBoolean("is_need_notification", true);
......@@ -143,7 +143,7 @@ public class BirdService extends Service {
+ ", amapLocation.getAccuracy():"+amapLocation.getAccuracy()
+"amapLocation.getLocationType()" + amapLocation.getLocationType());
if (mLocationCount > 5){
if (mLocationCount > 3){
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
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!