Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
石璀亮
/
agenew_a16_sos
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 01b49513
authored
Apr 16, 2019
by
cuiliang.shi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置中定时版本
1 parent
29a62ad3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
29 deletions
app/build.gradle
app/src/main/java/com/agenew/location_server/application/AlarmReceiver.java
app/src/main/java/com/agenew/location_server/application/BirdService.java
app/build.gradle
View file @
01b4951
...
...
@@ -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
{
...
...
app/src/main/java/com/agenew/location_server/application/AlarmReceiver.java
View file @
01b4951
...
...
@@ -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
);
}
}
app/src/main/java/com/agenew/location_server/application/BirdService.java
View file @
01b4951
...
...
@@ -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
());
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment