Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6746] Android: Map - MapView does not render if used in a non-url referenced window or tableview

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-05-09T16:05:43.000+0000
Affected Version/sRelease 1.7.3
Fix Version/sn/a
ComponentsAndroid
Labelslook1, parity
ReporterJohn Scanlon
AssigneeJosh Roesslein
Created2011-08-12T13:46:02.000+0000
Updated2017-03-21T21:06:15.000+0000

Description

Behavior

MapView does not render if used in a non-url referenced window or tableview. The map only shows grids, does not update.

Steps to Reproduce

Add a mapview to one of the tweetanium's 'tabs'. I used this code below
(function() {
	//create the mapview
	tt.ui.createMapView = function(_args) {
		
		var mapView = Titanium.Map.createView({
			mapType: Titanium.Map.STANDARD_TYPE,
			region:{latitude:39.9645745, longitude:-75.137527, latitudeDelta:0.01, longitudeDelta:0.01},
			regionFit:true,
			userLocation:false
		});

		return mapView;
	};
})();
then reference tt.ui.createMapView() in the views property of tt.ui.createFilmStripView. This is not an issue with an invalid map api key. To verify it wasn't, in the same app i have a menu item that creates a window with a url referencing a map.js file that creates the same mapview as mentioned above. It then opens this window up. The map displays fine, verifing the map api key I have is valid.

Related Discussions

[Maps on tweetanium (2 weeks of forum searching and testing, still no luck)](http://developer.appcelerator.com/question/124085/maps-on-tweetanium-2-weeks-of-forum-searching-and-testing-still-no-luck)

Workaround

See comments

Comments

  1. Fredrik Motin 2011-09-12

    This seems to be the exact same issue that we have run into. Posted in the forums under http://developer.appcelerator.com/question/124831/map-view-tiles-not-showing The tiles show only if I don't load any other controls, images or widgets in the other views. Also, the tiles show when only the map view is enable and no other tabs. But whenever the map view is shown as one of other tabs with their own UI etc, the tiles refuse to load 95% of the time. Is this a memory management problem? What can we provide to help investigate this issue closer to a solution?
  2. Fredrik Motin 2011-09-21

    We have now confirmed that opening the mapview in a new window (and new context) results in a working mapview, regardless of how many controls, images or widgets exists in the other views... This is definitely a problem with the Tweetanium architecture, resulting in unusable mapviews there-in. How can we help solving this issue?
  3. Paul Dowsett 2011-09-23

    Guys Please see the information about Google maps at [Titanium Compatibility Matrix](http://wiki.appcelerator.org/display/guides/Titanium+Compatibility+Matrix). Thus, would you please test your code in the emulator using Android APIs 2.2, and let me know whether it improves the issue. Thanks
  4. Mike Robinson 2011-09-23

    I was having the issue as well, even with the Google APIs. It seems to be fixed for me if I create the map completely within the event listener for window.open(). And I mean completely within, only the variable vwMap should exist outside, the Ti.Map.createView must be within the window.open for it to work.
  5. Tony Lukasavage 2011-11-29

    The issue still definitely exists in 1.8.x CI, tested against the Android 2.2 emulator with the Google APIs. I was able to get it working using the workaround of defining the mapview in the window.open() event.
  6. Paul Dowsett 2011-12-19

    According to TonyL, mapviews don't work properly in single context if you define them before the window open(). Hence, the following workaround can be used:
       var mapview;
       
       win.addEventListener('open', function(e) {
       	mapview = Ti.Map.createMapView();
       	// the rest of the code
       });
       
  7. Johnny Wong 2012-01-03

    Will there be any resolution to this ticket? I am running into this issue when showing the mapview in multiple places (doing all the stuff about same javascript context, lightweight windows, and adding/removing the mapview). @appcelerator -- Stuff like this is what makes us hold off on having full commitment to titanium and getting the enterprise license for our startup
  8. Neeraj Gupta 2012-04-30

    @Johnny - We are now working on this issue actively.
  9. Josh Roesslein 2012-04-30

    @Johnny On Android be sure you only have one MapView attached at a time. The Google Maps library only allows one active map per a process. If your issue is different could you please provide us more details? A simple test case and steps to reproduce would be very helpful. Please create a new ticket if this isn't related to Tweetanium. Also please test against the latest SDK, there have been fixes applied since this ticket was created that may solve your issue.
  10. Josh Roesslein 2012-05-09

    Please direct any bugs with Tweeanium over to its [Github project](https://github.com/appcelerator-titans/tweetanium) which is managed now by the Titan community. If there is a platform issue please open a new issue w/ a test case that demonstrates the bug.
  11. Lee Morris 2017-03-21

    Closing ticket as invalid.

JSON Source