Compare commits

...

2 commits

3 changed files with 17 additions and 2 deletions

View file

@ -40,4 +40,14 @@ dependencies {
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
val room_version = "2.6.1"
implementation("androidx.room:room-runtime:$room_version")
annotationProcessor("androidx.room:room-compiler:$room_version")
// optional - RxJava3 support for Room
implementation("androidx.room:room-rxjava3:$room_version")
// optional - Guava support for Room, including Optional and ListenableFuture
implementation("androidx.room:room-guava:$room_version")
}

View file

@ -1,9 +1,10 @@
package com.proculite.logmylocation;
import android.location.LocationListener;
import android.os.Binder;
public class LocationLoggingServiceBinder extends Binder {
public final LocationLoggingService service;
private final LocationLoggingService service;
public LocationLoggingServiceBinder(LocationLoggingService service){
this.service = service;
@ -12,4 +13,8 @@ public class LocationLoggingServiceBinder extends Binder {
public LocationLoggingService getService(){
return this.service;
}
public void subscribeToLocationUpdates(LocationListener locationListener){
this.service.subscribeToLocationUpdates(locationListener);
}
}

View file

@ -68,7 +68,7 @@ public class MainActivity extends AppCompatActivity implements LocationListener,
Log.d(TAG, "Service connected.");
LocationLoggingServiceBinder binder = (LocationLoggingServiceBinder) iBinder;
binder.getService().subscribeToLocationUpdates(this);
binder.subscribeToLocationUpdates(this);
}
@Override