Commit 8eea9fed by cuiliang.shi

外部调用更新

1 parent d96ff9f6
...@@ -4,10 +4,10 @@ android { ...@@ -4,10 +4,10 @@ android {
compileSdkVersion 28 compileSdkVersion 28
defaultConfig { defaultConfig {
applicationId "com.agenew.location_server.application" applicationId "com.agenew.location_server.application"
minSdkVersion 26 minSdkVersion 25
targetSdkVersion 28 targetSdkVersion 28
versionCode 4 versionCode 5
versionName "1.3" versionName "1.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
...@@ -32,5 +32,5 @@ dependencies { ...@@ -32,5 +32,5 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.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 @@ ...@@ -30,7 +30,8 @@
<meta-data android:name="com.amap.api.v2.apikey" android:value="2e40c8d145f8a0d4f9bb1cc7590594e7"> <meta-data android:name="com.amap.api.v2.apikey" android:value="2e40c8d145f8a0d4f9bb1cc7590594e7">
</meta-data> </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> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<!--<category android:name="android.intent.category.LAUNCHER" />--> <!--<category android:name="android.intent.category.LAUNCHER" />-->
...@@ -56,7 +57,9 @@ ...@@ -56,7 +57,9 @@
<action android:name="com.bird.close_sos" /> <action android:name="com.bird.close_sos" />
</intent-filter> </intent-filter>
</receiver> </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> </service>
<receiver android:name="com.agenew.location_server.application.AlarmReceiver"></receiver> <receiver android:name="com.agenew.location_server.application.AlarmReceiver"></receiver>
</application> </application>
......
...@@ -75,7 +75,6 @@ public class BirdService extends Service { ...@@ -75,7 +75,6 @@ public class BirdService extends Service {
return null; return null;
} }
@RequiresApi(api = Build.VERSION_CODES.O)
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
...@@ -101,7 +100,7 @@ public class BirdService extends Service { ...@@ -101,7 +100,7 @@ public class BirdService extends Service {
searchGPS(); searchGPS();
mHandler.sendEmptyMessageDelayed(0, 1000*60); mHandler.sendEmptyMessageDelayed(0, 1000);
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
} }
...@@ -128,7 +127,7 @@ public class BirdService extends Service { ...@@ -128,7 +127,7 @@ public class BirdService extends Service {
+ ", amapLocation.getAccuracy():"+amapLocation.getAccuracy() + ", amapLocation.getAccuracy():"+amapLocation.getAccuracy()
+"amapLocation.getLocationType()" + amapLocation.getLocationType()); +"amapLocation.getLocationType()" + amapLocation.getLocationType());
if (mLocationCount > 3){ if (mLocationCount > 4){
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());
...@@ -170,7 +169,7 @@ public class BirdService extends Service { ...@@ -170,7 +169,7 @@ public class BirdService extends Service {
PendingIntent pendingIntent2 = PendingIntent.getBroadcast(getApplicationContext(), 0, i, 0); PendingIntent pendingIntent2 = PendingIntent.getBroadcast(getApplicationContext(), 0, i, 0);
long triggerAtTime = SystemClock.elapsedRealtime(); long triggerAtTime = SystemClock.elapsedRealtime();
triggerAtTime = triggerAtTime + mInterval + 10; triggerAtTime = triggerAtTime + mInterval + 10;
manger.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, pendingIntent2); manger.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, pendingIntent2);
} }
stopForeground(true); stopForeground(true);
...@@ -312,6 +311,8 @@ public class BirdService extends Service { ...@@ -312,6 +311,8 @@ public class BirdService extends Service {
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
mLocationOption.setInterval(1000); mLocationOption.setInterval(1000);
mLocationOption.setLocationCacheEnable(false); mLocationOption.setLocationCacheEnable(false);
mLocationOption.setGpsFirst(true);
mLocationOption.setGpsFirstTimeout(10*1000);
mLocationClient.setLocationOption(mLocationOption); mLocationClient.setLocationOption(mLocationOption);
mLocationClient.startLocation(); mLocationClient.startLocation();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!