Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19726] Android: Refactor map module to remove deprecated method getMap()

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-10-19T03:05:25.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sRelease 5.2.0
ComponentsAndroid
Labelsn/a
ReporterHieu Pham
AssigneeHieu Pham
Created2015-10-14T21:29:17.000+0000
Updated2016-01-15T19:37:06.000+0000

Description

getMap() method is deprecated, we need to use getMapAsync() instead.

Comments

  1. Hieu Pham 2015-10-14

    map PR: https://github.com/appcelerator-modules/ti.map/pull/130 master PR: https://github.com/appcelerator/titanium_mobile/pull/7306
  2. Ashraf Abu 2015-10-19

    Tested with code:
       var MapModule = require('ti.map');
       var win = Ti.UI.createWindow({backgroundColor: 'white'});
       var opera = MapModule.createAnnotation({
           latitude: -33.8569,
           longitude: 151.2153,
           image: 'SydneyOperaHouse.jpg',
           title: 'Sydney Opera House',
           subtitle: 'Sydney, New South Wales, Australia'
       });
       var bridge = MapModule.createAnnotation({
           latitude: -33.852222,
           longitude: 151.210556,
           pincolor: MapModule.ANNOTATION_AZURE,
           // Even though we are creating a button, it does not respond to Button events or animates.
           // Use the Map View's click event and monitor the clicksource property for 'leftPane'.
           leftView: Ti.UI.createButton({title: 'Detail'}),
           // For eventing, use the Map View's click event
           // and monitor the clicksource property for 'rightPane'.
           rightButton: 'SydneyHarbourBridge.jpg',    
           title: 'Sydney Harbour Bridge',
           subtitle: 'Port Jackson'
       });
       var random = MapModule.createAnnotation({
           latitude: -33.87365,
           longitude: 151.20689,
           pincolor: MapModule.ANNOTATION_VIOLET,
           // Even though we are creating a label, it does not respond to Label events.
           // Use the Map View's events instead.    
           customView: Ti.UI.createLabel({
               text: 'MOVE ME!',
               opacity: '80%',
               color: 'red',
               backgroundColor: 'gray',
               font: {
                   fontSize: '16dp',
                   fontWeight: 'bold'
               }
           }),
           draggable: true
       });
       var mapview = MapModule.createView({
           mapType: MapModule.NORMAL_TYPE,
           region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 },
           annotations: [bridge,opera] //< add these annotations upon creation
       });
       // Add this annotation after creation
       mapview.addAnnotation(random);
       win.add(mapview);
       win.open();
       
  3. Ashraf Abu 2015-10-19

    Both PR merged.
  4. Lokesh Choudhary 2016-01-15

    Ran QE android map tests with 2.3.6 Map module & no issues were found. Closing. Environment: Appc Studio : 4.5.0.201601131150 Ti SDK : 5.2.0.v20160114021251 Ti CLI : 5.0.5 Alloy : 1.7.26 MAC Yosemite : 10.10.5 Appc NPM : 4.2.2 Appc CLI : 5.1.0 Node: v0.12.27 Map Module: 2.3.6 Nexus 6P - Android 6.0 Nexus 5 - Android 5.1.1

JSON Source