Compare commits
2 commits
77e343bfbb
...
1a64788590
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a64788590 | ||
|
|
ce6c090d19 |
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue