Search in sources :

Example 1 with LocationAjaxCallback

use of com.androidquery.callback.LocationAjaxCallback in project androidquery by androidquery.

the class AQueryLocationTest method testLocationIter3Acc10000.

public void testLocationIter3Acc10000() {
    LocationAjaxCallback cb = new LocationAjaxCallback() {

        private int n;

        @Override
        public void callback(String url, Location loc, AjaxStatus status) {
            n++;
            AQUtility.debug(n);
            AQUtility.debug(loc);
            assertNotNull(loc);
            if (n == 3) {
                assertEquals("gps", loc.getProvider());
            }
        }
    };
    cb.timeout(30 * 1000).accuracy(10000).iteration(3).tolerance(-1);
    cb.async(getActivity());
    waitAsync(5000);
}
Also used : LocationAjaxCallback(com.androidquery.callback.LocationAjaxCallback) AjaxStatus(com.androidquery.callback.AjaxStatus) Location(android.location.Location)

Example 2 with LocationAjaxCallback

use of com.androidquery.callback.LocationAjaxCallback in project androidquery by androidquery.

the class AQueryLocationTest method testLocationIter2AccFail.

public void testLocationIter2AccFail() {
    LocationAjaxCallback cb = new LocationAjaxCallback() {

        private int n;

        @Override
        public void callback(String url, Location loc, AjaxStatus status) {
            n++;
            AQUtility.debug(n);
            AQUtility.debug(loc);
            if (n == 2) {
                assertNull(loc);
                assertEquals(AjaxStatus.TRANSFORM_ERROR, status.getCode());
            } else if (n < 2) {
                assertNotNull(loc);
            } else {
                assertTrue(false);
            }
        }
    };
    cb.timeout(5 * 1000).accuracy(-1).iteration(2).tolerance(-1);
    cb.async(getActivity());
    waitAsync(6000);
}
Also used : LocationAjaxCallback(com.androidquery.callback.LocationAjaxCallback) AjaxStatus(com.androidquery.callback.AjaxStatus) Location(android.location.Location)

Example 3 with LocationAjaxCallback

use of com.androidquery.callback.LocationAjaxCallback in project androidquery by androidquery.

the class AQueryLocationTest method testLocationIter1Acc10000.

public void testLocationIter1Acc10000() {
    LocationAjaxCallback cb = new LocationAjaxCallback() {

        private int n;

        @Override
        public void callback(String url, Location loc, AjaxStatus status) {
            n++;
            AQUtility.debug(n);
            AQUtility.debug(loc);
            assertNotNull(loc);
            if (n == 1) {
                assertEquals("gps", loc.getProvider());
            }
        }
    };
    cb.timeout(5 * 1000).accuracy(10000).iteration(1).tolerance(-1);
    cb.async(getActivity());
    waitAsync(5000);
}
Also used : LocationAjaxCallback(com.androidquery.callback.LocationAjaxCallback) AjaxStatus(com.androidquery.callback.AjaxStatus) Location(android.location.Location)

Example 4 with LocationAjaxCallback

use of com.androidquery.callback.LocationAjaxCallback in project androidquery by androidquery.

the class LocationActivity method location_ajax.

public void location_ajax() {
    aq.id(R.id.result).text("");
    LocationAjaxCallback cb = new LocationAjaxCallback();
    cb.weakHandler(this, "locationCb").timeout(30 * 1000).accuracy(1000).iteration(3);
    cb.async(this);
    this.cb = cb;
}
Also used : LocationAjaxCallback(com.androidquery.callback.LocationAjaxCallback)

Example 5 with LocationAjaxCallback

use of com.androidquery.callback.LocationAjaxCallback in project androidquery by androidquery.

the class AQueryLocationTest method testLocationIter2Acc10000.

public void testLocationIter2Acc10000() {
    LocationAjaxCallback cb = new LocationAjaxCallback() {

        private int n;

        @Override
        public void callback(String url, Location loc, AjaxStatus status) {
            n++;
            AQUtility.debug(n);
            AQUtility.debug(loc);
            assertNotNull(loc);
            if (n == 2) {
                assertEquals("gps", loc.getProvider());
            }
        }
    };
    cb.timeout(30 * 1000).accuracy(10000).iteration(2).tolerance(-1);
    cb.async(getActivity());
    waitAsync(5000);
}
Also used : LocationAjaxCallback(com.androidquery.callback.LocationAjaxCallback) AjaxStatus(com.androidquery.callback.AjaxStatus) Location(android.location.Location)

Aggregations

LocationAjaxCallback (com.androidquery.callback.LocationAjaxCallback)6 Location (android.location.Location)4 AjaxStatus (com.androidquery.callback.AjaxStatus)4