Skip to content

Commit

Permalink
add Context.BIND_IMPORTANT in bindService
Browse files Browse the repository at this point in the history
  • Loading branch information
GrazianoCapelli committed Nov 25, 2017
1 parent b8d95a1 commit 8cca8ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
minSdkVersion 8
targetSdkVersion 23
versionCode 19
versionName '2.1.9b_20171112'
versionName '2.1.9b_20171125'
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import android.location.LocationManager;
import android.location.LocationProvider;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
Expand Down Expand Up @@ -206,8 +207,13 @@ public void onServiceDisconnected(ComponentName arg0) {

private void StartAndBindGPSService() {
GPSServiceIntent = new Intent(GPSApplication.this, GPSService.class);
startService(GPSServiceIntent); //Starting the service
bindService(GPSServiceIntent, GPSServiceConnection, Context.BIND_AUTO_CREATE); //Binding to the service!
//Start the service
startService(GPSServiceIntent);
//Bind to the service
if (Build.VERSION.SDK_INT >= 14)
bindService(GPSServiceIntent, GPSServiceConnection, Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT);
else
bindService(GPSServiceIntent, GPSServiceConnection, Context.BIND_AUTO_CREATE);
Log.w("myApp", "[#] GPSApplication.java - StartAndBindGPSService");
}

Expand Down

0 comments on commit 8cca8ce

Please sign in to comment.