-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setting up service to start at application launch
- Loading branch information
Showing
7 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
android/src/gov/nasa/arc/geocam/memo/service/GeoLocationListenerImplementation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
android/src/gov/nasa/arc/geocam/memo/service/GeoLocationListenerInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package gov.nasa.arc.geocam.memo.service; | ||
|
||
import android.location.Location; | ||
import android.location.LocationListener; | ||
|
||
public interface GeoLocationListenerInterface { | ||
public interface GeoLocationListenerInterface extends LocationListener { | ||
public Location getLocation(); | ||
} |
31 changes: 31 additions & 0 deletions
31
android/src/gov/nasa/arc/geocam/memo/service/GeoLocationServiceImplementation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package gov.nasa.arc.geocam.memo.service; | ||
|
||
import android.app.Service; | ||
import android.content.Intent; | ||
import android.location.Location; | ||
import android.location.LocationManager; | ||
import android.os.IBinder; | ||
|
||
import com.google.inject.Inject; | ||
|
||
public class GeoLocationServiceImplementation extends Service | ||
implements GeoLocationServiceInterface { | ||
|
||
@Inject GeoLocationListenerInterface listener; | ||
@Inject LocationManager locationManager; | ||
|
||
@Override | ||
public IBinder onBind(Intent intent) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 1, listener); | ||
} | ||
|
||
@Override | ||
public Location getLocation() { | ||
return listener.getLocation(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
android/src/gov/nasa/arc/geocam/memo/service/GeoLocationServiceInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package gov.nasa.arc.geocam.memo.service; | ||
|
||
import android.location.Location; | ||
|
||
public interface GeoLocationServiceInterface { | ||
public Location getLocation(); | ||
} |