Commit 360de990 authored by Vyacheslav Koscheev's avatar Vyacheslav Koscheev

add try-catch to LocationRequest initialization

parent 7b3e7bad
...@@ -317,25 +317,31 @@ public class GmsLocationProvider implements ConnectionCallbacks, OnConnectionFai ...@@ -317,25 +317,31 @@ public class GmsLocationProvider implements ConnectionCallbacks, OnConnectionFai
Log.i(TAG, "startLocationUpdates"); Log.i(TAG, "startLocationUpdates");
LocationRequest request = new LocationRequest(); LocationRequest request = new LocationRequest();
request
.setPriority(priority)
.setInterval(interval)
.setFastestInterval(fastestInterval);
if (maxWaitTime > 0) { try {
request.setMaxWaitTime(maxWaitTime); request
} .setPriority(priority)
.setInterval(interval)
.setFastestInterval(fastestInterval);
if (numUpdates > 0) { if (maxWaitTime > 0) {
request.setNumUpdates(numUpdates); request.setMaxWaitTime(maxWaitTime);
} }
if (expirationDuration > 0) { if (numUpdates > 0) {
request.setExpirationDuration(expirationDuration); request.setNumUpdates(numUpdates);
} }
if (expirationDuration > 0) {
request.setExpirationDuration(expirationDuration);
}
if (expirationTime > 0) { if (expirationTime > 0) {
request.setExpirationTime(expirationTime); request.setExpirationTime(expirationTime);
}
}
catch (Throwable e) {
Log.e(TAG, "Failed to init LocationRequest", e);
} }
final Long requestId = ++mLastRequestId; final Long requestId = ++mLastRequestId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment