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 8eea9fed
authored
Apr 18, 2019
by
cuiliang.shi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
外部调用更新
1 parent
d96ff9f6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
10 deletions
app/build.gradle
app/src/main/AndroidManifest.xml
app/src/main/java/com/agenew/location_server/application/BirdService.java
app/build.gradle
View file @
8eea9fe
...
...
@@ -4,10 +4,10 @@ android {
compileSdkVersion
28
defaultConfig
{
applicationId
"com.agenew.location_server.application"
minSdkVersion
2
6
minSdkVersion
2
5
targetSdkVersion
28
versionCode
4
versionName
"1.
3
"
versionCode
5
versionName
"1.
5
"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes
{
...
...
@@ -32,5 +32,5 @@ dependencies {
testImplementation
'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
implementation
'com.amap.api:location:
latest.integration
'
implementation
'com.amap.api:location:
4.5.1
'
}
app/src/main/AndroidManifest.xml
View file @
8eea9fe
...
...
@@ -30,7 +30,8 @@
<meta-data
android:name=
"com.amap.api.v2.apikey"
android:value=
"2e40c8d145f8a0d4f9bb1cc7590594e7"
>
</meta-data>
<activity
android:name=
"com.agenew.location_server.application.MainActivity"
>
<activity
android:name=
"com.agenew.location_server.application.MainActivity"
android:exported=
"true"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<!--<category android:name="android.intent.category.LAUNCHER" />-->
...
...
@@ -56,7 +57,9 @@
<action
android:name=
"com.bird.close_sos"
/>
</intent-filter>
</receiver>
<service
android:name=
"com.agenew.location_server.application.BirdService"
>
<service
android:name=
"com.agenew.location_server.application.BirdService"
android:enabled=
"true"
android:exported=
"true"
>
</service>
<receiver
android:name=
"com.agenew.location_server.application.AlarmReceiver"
></receiver>
</application>
...
...
app/src/main/java/com/agenew/location_server/application/BirdService.java
View file @
8eea9fe
...
...
@@ -75,7 +75,6 @@ public class BirdService extends Service {
return
null
;
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
O
)
@Override
public
void
onCreate
()
{
super
.
onCreate
();
...
...
@@ -101,7 +100,7 @@ public class BirdService extends Service {
searchGPS
();
mHandler
.
sendEmptyMessageDelayed
(
0
,
1000
*
60
);
mHandler
.
sendEmptyMessageDelayed
(
0
,
1000
);
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
}
...
...
@@ -128,7 +127,7 @@ public class BirdService extends Service {
+
", amapLocation.getAccuracy():"
+
amapLocation
.
getAccuracy
()
+
"amapLocation.getLocationType()"
+
amapLocation
.
getLocationType
());
if
(
mLocationCount
>
3
){
if
(
mLocationCount
>
4
){
SimpleDateFormat
dateformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
mStartTime
=
dateformat
.
format
(
System
.
currentTimeMillis
());
...
...
@@ -170,7 +169,7 @@ public class BirdService extends Service {
PendingIntent
pendingIntent2
=
PendingIntent
.
getBroadcast
(
getApplicationContext
(),
0
,
i
,
0
);
long
triggerAtTime
=
SystemClock
.
elapsedRealtime
();
triggerAtTime
=
triggerAtTime
+
mInterval
+
10
;
manger
.
setExact
AndAllowWhileIdle
(
AlarmManager
.
ELAPSED_REALTIME_WAKEUP
,
triggerAtTime
,
pendingIntent2
);
manger
.
setExact
(
AlarmManager
.
ELAPSED_REALTIME_WAKEUP
,
triggerAtTime
,
pendingIntent2
);
}
stopForeground
(
true
);
...
...
@@ -312,6 +311,8 @@ public class BirdService extends Service {
mLocationOption
.
setLocationMode
(
AMapLocationClientOption
.
AMapLocationMode
.
Hight_Accuracy
);
mLocationOption
.
setInterval
(
1000
);
mLocationOption
.
setLocationCacheEnable
(
false
);
mLocationOption
.
setGpsFirst
(
true
);
mLocationOption
.
setGpsFirstTimeout
(
10
*
1000
);
mLocationClient
.
setLocationOption
(
mLocationOption
);
mLocationClient
.
startLocation
();
...
...
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