In regards to API access, I can’t seem to be able to properly use the Maps on CoronaViewer.
When I compile for Android the following simple example (taken from examples from CoronaLabs’YT channel) and install it as apk on my device, it works as expected.
When I try to execute it via CoronaViewer, the map shows up centered in the ocean, and the marker is not positioned. I can scroll to the Eiffel Tower and find Google’s tooltip for it if I click on it.
Can somebody please help me in finding what’s wrong?
I did copy the required permissions from build.settings to CoronaViewer’s and compile it accordingly.
This is the simple map example code:
[lua]
myMap = native.newMapView(400, 600, 700, 1100)
local lat, long = myMap:getAddressLocation( “Eiffel Tower” ) – this doesn’t work
–local lat, long = 48.85815, 2.29452 – if I specify lat, long like this, map gets correctly centered
myMap:setCenter(lat, long) – this works when coords are hardwired
myMap:addMarker(lat, long, {title = “Big Tower”, subtitle = “It’s in France”}) – this doesn’t work
[/lua]
This is the current build.settings with which I compiled CoronaVIewer:
[lua]
settings =
{
orientation =
{
default = “portrait”,
supported = { “portrait” },
– supported = { “landscapeLeft”, “landscapeRight”, “portrait”, “portraitUpsideDown” },
},
plugins =
{
– key is the name passed to Lua’s ‘require()’
[“plugin.viewer”] =
{
– required
publisherId = “com.coronalabs”,
},
},
iphone =
{
plist =
{
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“db-l1q0pln8qsi8qyp”,
}
}
}
},
},
android =
{
usesPermissions =
{
“android.permission.INTERNET”,
--optional permission used to display current location via the GPS
“android.permission.ACCESS_FINE_LOCATION”,
--optional permission used to display current location via WiFi or cellular service
“android.permission.ACCESS_COARSE_LOCATION”,
},
usesFeatures =
{
– If you set permissions “ACCESS_FINE_LOCATION” and “ACCESS_COARSE_LOCATION” above,
– you may want to set up your app to not require location services as follows.
– Otherwise, devices that do not have location sevices (such as a GPS) will be unable
– to purchase this app in the app store.
{ name = “android.hardware.location”, required = false },
{ name = “android.hardware.location.gps”, required = false },
{ name = “android.hardware.location.network”, required = false }
},
},
}
[/lua]
This is the config.settings of my app, which makes the example work on my android device when compiled as apk and installed:
[lua]
settings =
{
android =
{
usesPermissions =
{
“android.permission.INTERNET”,
--optional permission used to display current location via the GPS
“android.permission.ACCESS_FINE_LOCATION”,
--optional permission used to display current location via WiFi or cellular service
“android.permission.ACCESS_COARSE_LOCATION”,
},
usesFeatures =
{
– If you set permissions “ACCESS_FINE_LOCATION” and “ACCESS_COARSE_LOCATION” above,
– you may want to set up your app to not require location services as follows.
– Otherwise, devices that do not have location sevices (such as a GPS) will be unable
– to purchase this app in the app store.
{ name = “android.hardware.location”, required = false },
{ name = “android.hardware.location.gps”, required = false },
{ name = “android.hardware.location.network”, required = false }
},
},
}
[/lua]
Many thanks!