public abstract class BaseGoogleLocationClient extends Object implements LocationCallbacks.LocationClient, LocationListener
GoogleLocationClient
,
GoogleLocationClientNew
Modifier | Constructor and Description |
---|---|
protected |
BaseGoogleLocationClient()
Initialises a newly created
BaseGoogleLocationClient object. |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
buildClient(Activity activity)
Builds the client to work with Google Play Services Location APIs.
|
LocationRequest |
createNewLocationRequest()
Creates new
LocationRequest . |
Location |
getCurrentLocation()
Please refer to the base method description.
|
protected void |
getFromBundle(Bundle savedInstanceState)
Updates fields based on data stored in the bundle.
|
Date |
getLastUpdateTime()
Please refer to the base method description.
|
void |
onCreate(Activity activity,
Bundle savedInstanceState)
Please refer to the base method description.
|
void |
onDestroy(Activity activity)
Please refer to the base method description.
|
void |
onLocationChanged(Location location)
Please refer to the base method description.
|
void |
onPause(Activity activity)
Please refer to the base method description.
|
void |
onResume(Activity activity)
Please refer to the base method description.
|
void |
onSaveInstanceState(Activity activity,
Bundle savedInstanceState)
Please refer to the base method description.
|
void |
onStart(Activity activity)
Please refer to the base method description.
|
void |
onStop(Activity activity)
Please refer to the base method description.
|
protected void |
requestLocationUpdates(Activity activity,
LocationRequest locationRequest)
Requests location updates.
|
protected void |
setLocation(Location location)
Sets the current location.
|
void |
setLocationCallbacks(LocationCallbacks locationCallbacks)
Please refer to the base method description.
|
BaseGoogleLocationClient |
setLocationUpdatesParameters(boolean requestingLocationUpdates,
boolean highAccuracy)
Sets the requesting location updates parameters.
|
BaseGoogleLocationClient |
setLocationUpdatesParameters(boolean requestingLocationUpdates,
int priority,
long interval,
long fastestInterval)
Sets the requesting location updates parameters.
|
BaseGoogleLocationClient |
setLocationUpdatesParameters(boolean requestingLocationUpdates,
int priority,
long interval,
long fastestInterval,
Long expirationDuration,
Long expirationTime,
Long maxWaitTime,
Integer numUpdates,
Float smallestDisplacement)
Sets the requesting location updates parameters.
|
void |
setUniqueUpdates(boolean value)
Sets the flag indicating whether the location updates callbacks should be called
for changed values only.
|
protected void |
startLocationUpdates(Activity activity)
Starts location updates.
|
protected void |
stopLocationUpdates(Activity activity)
Stops location updates.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onActivityResult
protected BaseGoogleLocationClient()
BaseGoogleLocationClient
object.public void setUniqueUpdates(boolean value)
true
.value
- true
for changed values only location updates, false
otherwisepublic Location getCurrentLocation()
getCurrentLocation
in interface LocationCallbacks.LocationClient
public Date getLastUpdateTime()
getLastUpdateTime
in interface LocationCallbacks.LocationClient
public void setLocationCallbacks(LocationCallbacks locationCallbacks)
setLocationCallbacks
in interface LocationCallbacks.LocationClient
locationCallbacks
- The locationCallbacks
@CallSuper public void onSaveInstanceState(Activity activity, Bundle savedInstanceState)
onSaveInstanceState
in interface LocationCallbacks.LocationClient
activity
- The ActivitysavedInstanceState
- The last saved instance state of the Activity, or null@CallSuper public void onCreate(Activity activity, Bundle savedInstanceState)
onCreate
in interface LocationCallbacks.LocationClient
activity
- The ActivitysavedInstanceState
- The last saved instance state of the Activity, or nullpublic void onStart(Activity activity)
onStart
in interface LocationCallbacks.LocationClient
activity
- The Activitypublic void onResume(Activity activity)
onResume
in interface LocationCallbacks.LocationClient
activity
- The Activitypublic void onPause(Activity activity)
onPause
in interface LocationCallbacks.LocationClient
activity
- The Activitypublic void onStop(Activity activity)
onStop
in interface LocationCallbacks.LocationClient
activity
- The Activitypublic void onDestroy(Activity activity)
onDestroy
in interface LocationCallbacks.LocationClient
activity
- The Activitypublic BaseGoogleLocationClient setLocationUpdatesParameters(boolean requestingLocationUpdates, boolean highAccuracy)
requestingLocationUpdates
- true
for requesting location updates, false
otherwisehighAccuracy
- true
for high accuracy location updates, false
otherwiseBaseGoogleLocationClient
object, so that setters can be chainedLocationRequest
public BaseGoogleLocationClient setLocationUpdatesParameters(boolean requestingLocationUpdates, int priority, long interval, long fastestInterval)
requestingLocationUpdates
- true
for requesting location updates, false
otherwisepriority
- Sets the priority of the requestinterval
- Sets the desired interval for active location updates, in millisecondsfastestInterval
- Explicitly sets the fastest interval for location updates, in millisecondsBaseGoogleLocationClient
object, so that setters can be chainedLocationRequest
public BaseGoogleLocationClient setLocationUpdatesParameters(boolean requestingLocationUpdates, int priority, long interval, long fastestInterval, Long expirationDuration, Long expirationTime, Long maxWaitTime, Integer numUpdates, Float smallestDisplacement)
requestingLocationUpdates
- true
for requesting location updates, false
otherwisepriority
- Sets the priority of the requestinterval
- Sets the desired interval for active location updates, in millisecondsfastestInterval
- Explicitly sets the fastest interval for location updates, in millisecondsexpirationDuration
- Sets the duration of this request, in millisecondsexpirationTime
- Sets the request expiration time, in millisecond since bootmaxWaitTime
- Sets the maximum wait time in milliseconds for location updatesnumUpdates
- Sets the number of location updatessmallestDisplacement
- Sets the minimum displacement between location updates (in meters)BaseGoogleLocationClient
object, so that setters can be chainedLocationRequest
@CallSuper protected void getFromBundle(Bundle savedInstanceState)
savedInstanceState
- The activity state saved in the Bundle
public void onLocationChanged(Location location)
onLocationChanged
in interface LocationListener
protected void setLocation(Location location)
location
- The current locationprotected abstract void buildClient(@NonNull Activity activity)
activity
- The activitypublic LocationRequest createNewLocationRequest()
LocationRequest
.LocationRequest
protected void startLocationUpdates(@NonNull Activity activity)
activity
- The activityprotected void requestLocationUpdates(@NonNull Activity activity, @NonNull LocationRequest locationRequest)
activity
- The activitylocationRequest
- The LocationRequest
protected void stopLocationUpdates(Activity activity)
activity
- The activity
Copyright © 2015-2017 akha, a.k.a. Alexander Kharitonov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.