Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): also use GPS for low accuracy #10728

Merged
merged 5 commits into from Mar 1, 2019

Conversation

garymathews
Copy link
Contributor

@garymathews garymathews commented Feb 27, 2019

  • Also use GPS provider for low accuracy
  • Remove more legacy code
  • Fix STATE_DISABLED to output as an error
  • Allow requestLocationPermissions to fall through when permissions are already granted
TEST CASE
const win = Ti.UI.createWindow({ backgroundColor: 'gray' });
const listView = Ti.UI.createListView();
let count = 1;

Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_LOW;

function push (e) {
    let section = Ti.UI.createListSection({ headerTitle: '#' + count++ });
    if (e.success) {
        if (e.coords) {
            e = e.coords;
        }
        section.setItems([
            { properties: { title: 'LOCATION:\n' + e.latitude + ', ' + e.longitude, color: 'orange' } },
            { properties: { title: 'ALTITUDE:\n' + e.altitude, color: 'orange' } },
            { properties: { title: 'ACCURACY:\n' + e.accuracy, color: 'orange' } }
        ]);
    } else {
        section.setItems([
            { properties: { title: 'ERROR:\n' + e.error, color: 'red' } }
        ]);
    }
    listView.appendSection(section);
}

function getLocation () {
    Ti.Geolocation.addEventListener('location', push);
}

win.addEventListener('open', () => {
    Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, (e) => {
        if (e.success) {
            getLocation();
        } else {
            alert('could not obtain location permissions');
        }
    });
});

win.add(listView);
win.open();

JIRA Ticket

@garymathews garymathews added this to the 8.1.0 milestone Feb 27, 2019
@build build requested a review from a team February 27, 2019 01:09
@build
Copy link
Contributor

build commented Feb 27, 2019

Messages
📖 👍 Hey!, You deleted more code than you added. That's awesome!
📖

💾 Here's the generated SDK zipfile.

📖

✅ All tests are passing
Nice one! All 2991 tests are passing.

Generated by 🚫 dangerJS against 1cf9cb1

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

permissionCB.callAsync(getKrollObject(), response);
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! Good find.

@ssjsamir ssjsamir self-requested a review March 1, 2019 11:56
Copy link
Contributor

@ssjsamir ssjsamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FR Passed Able to get the Location, Altitude and Accuracy when using Ti.Geolocation.ACCURACY_LOW. Tested with the test case above.

Test Environment

Google pixel xl 7.1 Sim
APPC CLI: 7.0.10-17
Operating System Name: Mac OS Mojave
Operating System Version: 10.14.2
Node.js Version: 8.9.1
Xcode 10.1

@ssjsamir ssjsamir merged commit 4f0d858 into tidev:master Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants