Commit 8eea9fed by cuiliang.shi

外部调用更新

1 parent d96ff9f6
......@@ -4,10 +4,10 @@ android {
compileSdkVersion 28
defaultConfig {
applicationId "com.agenew.location_server.application"
minSdkVersion 26
minSdkVersion 25
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'
}
......@@ -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>
......
......@@ -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.setExactAndAllowWhileIdle(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();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!