Commit e113094c authored by Vyacheslav Koscheev's avatar Vyacheslav Koscheev

Fix passive location requests frequency

parent 8230f01f
......@@ -76,6 +76,7 @@ QGeoPositionInfoSourceAndroidPassive::QGeoPositionInfoSourceAndroidPassive(QObje
: QGeoPositionInfoSource(parent)
, jniLinker_(new JniObjectLinker(this))
, started_(false)
, update_interval_msec_(5 * 60 * 1000)
{
qRegisterMetaType<QGeoPositionInfo>();
setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods);
......@@ -91,7 +92,7 @@ void QGeoPositionInfoSourceAndroidPassive::startUpdates()
{
if (!started_ && isJniReady())
{
if (jni()->callBool("startLocationUpdates"))
if (jni()->callParamBoolean("startLocationUpdates", "I", update_interval_msec_))
{
started_ = true;
}
......@@ -117,7 +118,7 @@ void QGeoPositionInfoSourceAndroidPassive::requestUpdate(int timeout /*= 0*/)
void QGeoPositionInfoSourceAndroidPassive::setUpdateInterval(int msec)
{
Q_UNUSED(msec);
update_interval_msec_ = msec;
}
......
......@@ -70,4 +70,5 @@ private:
private:
bool started_;
jint update_interval_msec_;
};
......@@ -152,10 +152,10 @@ public class PassiveLocationProvider implements LocationListener
return false;
}
public boolean startLocationUpdates() {
public boolean startLocationUpdates(final int minTime) {
try {
if (null != mLocationManager) {
mLocationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0, 0, this, mlocationUpdatesLooper);
mLocationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, minTime, 0, this, mlocationUpdatesLooper);
return true;
}
} catch(Throwable e) {
......
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