Hello,
I’ve run into a bit of a problem whilst developing an app using Vaadin TouchKit. The app is heavily location based, and one of key functionalities is detecting your current position from the device and then proceeding. I’ve implemented this as follows:
public class LocationSelectMethodView extends NavigationView implements PositionCallback {
// snip code
// A button is pressed
applicationWindow.detectCurrentPosition(this); // ApplicationWindow inherits TouchKitWindow
public void onSuccess(Position position) {
Point location = new Point(position.getLongitude(), position.getLatitude());
// do something fancy with the location
}
public void onFailure(int i) {
// show popover with failure code
}
// snip code
This works like a charm on an Ipad, N9, Symbian device and the supported desktop browsers. These platforms behave as expected, they first ask the user for geolocation permission and then successfully achieve the correct location. If permission is denied, the popover is shown.
Android 4.0.4 on a Samsung Galaxy S3 presents the problem that I’m facing: this doesn’t work either with the default browser nor Chrome. On Chrome it at least asks for the permission, but neither one of the methods (onSuccess, onFailure) gets triggered. The default browser doesn’t even get around to asking a permission.
I’ve tried disabling GPS (so the device would figure out the location based on the mobile network), but the behaviour is still similar.
Anyone have geolocation working with any Android devices? This could be a problem with either Android not supporting the mechanism TK uses, or my device settings are incorrect. I’ve tested with the Maps-app that the device can detect its position, though. Any fixes and suggestions are very welcome.
Cheers,
Teme