#Region Project Attributes
#ApplicationLabel: Pocket Theodolite
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalRes: $AndroidSDK$\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#ExcludeClasses: .games, .drive, .fitness, .wearable, .measurement, .cast, .auth, .nearby
#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .vision, .gcm
'Remove the following line if you use AdMob
#ExcludeClasses: .ads
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim mFragment As MapFragment
Dim gmap As GoogleMap
Dim Map_Panel As Panel
Dim Map_Props As Map
Dim Map_Label As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Map_Panel.Initialize("")
Activity.AddView(Map_Panel, 0, 0, 100%x, 100%y)
Map_Props.Initialize
'Keys for Map_Props come from <designerProperty> entries in ...\Additional Libraries\GoogleMaps.xml
' <designerProperty>key:MapType, displayname:Map Type, fieldtype:String, defaultvalue:NORMAL, list:NORMAL|SATELLITE|TERRAIN</designerProperty>
' <designerProperty>key:MyLocationEnabled, displayname:My Location Enabled, fieldtype:Boolean, defaultvalue:True, description:Whether to show the user location on the map.</designerProperty>
' <designerProperty>key:TrafficEnabled, displayname:Traffic Enabled, fieldtype:Boolean, defaultvalue:False, description:Whether to show the traffic layer.</designerProperty>
' <designerProperty>key:BuildingsEnabled, displayname:Building Enabled, fieldtype:Boolean, defaultvalue:False, description:Whether to show the buildings layer.</designerProperty>
' <designerProperty>key:auto1CompassEnabled, displayname:Compass Enabled, fieldtype:Boolean, defaultvalue:True</designerProperty>
' <designerProperty>key:auto1MyLocationButtonEnabled, displayname:MyLocation Button Enabled, fieldtype:Boolean, defaultvalue:True</designerProperty>
' <designerProperty>key:auto1RotateGesturesEnabled, displayname:Rotate Gestures Enabled, fieldtype:Boolean, defaultvalue:True</designerProperty>
' <designerProperty>key:auto1ScrollGesturesEnabled, displayname:Scroll Gestures Enabled, fieldtype:Boolean, defaultvalue:True</designerProperty>
' <designerProperty>key:auto1TiltGesturesEnabled, displayname:Tilt Gestures Enabled, fieldtype:Boolean, defaultvalue:True</designerProperty>
' <designerProperty>key:auto1ZoomControlsEnabled, displayname:Zoom Controls Enabled, fieldtype:Boolean, defaultvalue:True</designerProperty>
' <designerProperty>key:auto1ZoomGesturesEnabled, displayname:Zoom Gestures Enabled, fieldtype:Boolean, defaultvalue:True</designerProperty>
'[display name] defines property name as seen in Designer
'By pure experimentation, these properties must be explicitly set
Map_Props.Put("MapType","NORMAL") 'Map Type
Map_Props.Put("MyLocationEnabled", True) 'My Location Enabled
Map_Props.Put("TrafficEnabled", False) 'Traffic Enabled
Map_Props.Put("BuildingsEnabled", False) 'Building Enabled
'These properties do not have to be explicitly set and presumably drop to their respective defaults if not
'Map_Props.Put("auto1CompassEnabled", True) 'Compass Enabled
'Map_Props.Put("auto1MyLocationButtonEnabled", True) 'MyLocation Button Enabled
'Map_Props.Put("auto1RotateGesturesEnabled", True) 'Rotate Gestures Enabled
'Map_Props.Put("auto1ScrollGesturesEnabled", True) 'Scroll Gestures Enabled
'Map_Props.Put("auto1TiltGesturesEnabled", True) 'Tilt Gestures Enabled
'Map_Props.Put("auto1ZoomControlsEnabled", True) 'Zoom Controls Enabled
'Map_Props.Put("auto1ZoomGesturesEnabled", True) 'Zoom Gestures Enabled
Map_Label.Initialize("")
If mFragment.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Google Play services not available.", True)
Else
mFragment.Initialize("Map", Activity)
mFragment.DesignerCreateView(Map_Panel, Map_Label, Map_Props)
'Map_Label does not appear to be needed, last statement can also be:
'mFragment.DesignerCreateView(Map_Panel, Null, Map_Props)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Map_Ready
'This is essential
Map_Panel.BringToFront
gmap = mFragment.GetMap
If gmap.IsInitialized = False Then
ToastMessageShow("Error initializing map.", True)
Else
gmap.AddMarker(36, 15, "Hello!!!")
Dim cp As CameraPosition
cp.Initialize(36, 15, gmap.CameraPosition.Zoom * 2)
gmap.AnimateCamera(cp)
End If
End Sub