Closed andersdp closed 7 years ago
Basically I just want our users to be able to navigate a map without being asked about access to gps location. We don't need their current location.
Thanks for the feedback! I'll check the issue, but does it help to manually disable the myLocationEnabled
property on the map view?
We have myLocationEnabled=false and it still asks for access.
But we're unsure of whether or not iOS is supposed to work like that?
This is the properties we use:
mapType: Map.MAP_TYPE_NORMAL,
zoomGestures: true,
indoorEnabled: false,
indoorPicker: false,
compassButton: false,
myLocationButton: false,
myLocationEnabled: false,
scrollGesture: false,
tiltGestures: false,
rotateGestures: false,
region:{
latitude:_lat,
longitude:_lng,
zoom: _zoom
}
Check the tiapp.xml if you're using:
key>NSLocationUsageDescription</key>
or
<key>NSLocationWhenInUseUsageDescription</key>
However, to my recollection, these don't ask for permission automatically.
On another note, maybe you have Ti.Geolocation.addEventlistener
somewhere?
We use NSLocationWhenInUseUsageDescription
Just checked a quick example, it doesn't ask me for permissions as well:
var maps = require('ti.googlemaps');
maps.setAPIKey('<api-key>');
var win = Ti.UI.createWindow({
backgroundColor: '#f00'
});
var mapView = maps.createView({
region: {
latitude: 37.368122,
longitude: -121.913653,
}
});
win.add(mapView);
win.open();
And as @yozef said, every Ti.Geolocation usage would also trigger the dialog. Side note: If you remove the module usage, does it still prompt then?
Okay, seems like I need to run through our code and make sure we don't do something that triggers it.
@hansemannn Just to be sure; It was a fresh install you did so the permission wasn't already set?
Yes. I uninstalled the app completely of course :-). Closing this issue for now, please let me know if it should be reopened when you can isolate it to the module. Thx!
@andersdp Do a quick Search on the project for Ti.Geolocation
or Titanium.Geolocation
Ok will run through our code - thanks for your time guys 👍🏼
Working on the same project as @andersdp, I was looking into this issue, and appearantly the app prompts for gps permission if you have the NSLocationWhenInUseUsageDescription
in tiapp.xml. Just creating the object like this:mapview = Map.createView({});
will trigger the prompt.
Thanks @jonasfunk, but then it's definitely the Google Maps iOS SDK causing the issue. I can try doing the same natively, but I'm pretty sure it behaves the same.
Would be nice to know, if it the outcome is the same natively. Seems strange that you're not able to generate a map without prompting the user for GPS access.
Checked it! It's indeed our bug - the "myLocationEnabled" property was enabled by default. Justed changed it, commit and new version coming later today. Thanks guys!
Hi @hansemannn is this what you are referring to, or is being set somewhere else?
- (void)setMyLocationEnabled:(id)value
{
ENSURE_UI_THREAD_1_ARG(value);
ENSURE_TYPE(value, NSNumber);
[[[self mapView] mapView] setMyLocationEnabled:[TiUtils boolValue:value]];
[self replaceValue:value forKey:@"myLocationEnabled" notification:NO];
}
Update: Ok, I see what you mean, it's here: https://github.com/hansemannn/ti.googlemaps/blob/master/ios/Classes/TiGooglemapsView.m
[_mapView setMyLocationEnabled:[TiUtils boolValue:[self.proxy valueForKey:@"myLocationEnabled"] def:YES]];
Fixed as part of https://github.com/hansemannn/ti.googlemaps/commit/8ec1f2eb0b573c80a0d863253d81ebaf7ec60997. @yozef The related bug was here and remained from early tests when i created the first draft of this module. In addition, the interactionEnabled
wasn't even used (part of UIKit
, not of the module), so I cleaned that up as well.
I don't think this is related to this (excellent) module but it seems like a good place to ask.
We have an app that relies heavily on an location. Either the current or one provided by the user. Recently we moved from users entering an address manually (if they didn't give access to location) to letting them pick out a location via map.
To the question: When users open a map for the first time is it not possible to avoid the question about giving access to location? We feed some coordinates into the map when opening and just want to give users the option of panning around to select a location.