pauloborges / meteor-mapbox

Mapbox.js for Meteor apps
43 stars 34 forks source link

Resolves Cordova Android issue. #4

Closed Sivli-Embir closed 9 years ago

Sivli-Embir commented 9 years ago

Cordova Android (v4.2.2) does not have a css 'load' event, or it does and it is broken -- not sure. Mapbox can operate just fine without requiring the css to be loaded first. In fact this fix may cause the maps to load faster as the css will be done async.

Sivli-Embir commented 9 years ago

Actually hold up, some of my map logic is broken. Will continue to look into it. But this does cause the map to show up on my device.

Sivli-Embir commented 9 years ago

Oh no, I was looking at page with no data and thus no markers to add. It works as described in my RP.

pauloborges commented 9 years ago

On Android 5:

I20150121-16:58:41.374(-3) (android:http://meteor.local/packages/pauloborges_mapbox.js:201) Loaded "https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js"
I20150121-16:58:41.434(-3) (android:http://meteor.local/packages/meteor.js:907) Exception from Tracker recompute function: Error: Map container not found.
I20150121-16:58:41.435(-3)? at s.Map.s.Class.extend._initContainer (https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js:1:27031)
I20150121-16:58:41.435(-3)? at s.Map.s.Class.extend.initialize (https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js:1:20440)
I20150121-16:58:41.435(-3)? at L.Map.extend.initialize (https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js:6:16116)
I20150121-16:58:41.436(-3)? at new e (https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js:1:3943)
I20150121-16:58:41.436(-3)? at Object.e.exports.map (https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js:6:18911)
I20150121-16:58:41.436(-3)? at http://meteor.local/main.js?0f2cf5023436f7c5590b8046ca038e735ee6a5a9:8:26
I20150121-16:58:41.436(-3)? at Tracker.Computation._compute (http://meteor.local/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:288:36)
I20150121-16:58:41.436(-3)? at Tracker.Computation._recompute (http://meteor.local/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:302:14)
I20150121-16:58:41.436(-3)? at Tracker.flush (http://meteor.local/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:430:14)
Sivli-Embir commented 9 years ago

Wow... that is going to be a pain. That was from the demo I take it?

Sivli-Embir commented 9 years ago

How about web? Does Android 5 still have the issues via Chrome? If its just Cordova we can do device detection.

Sivli-Embir commented 9 years ago

Or OS version detection as the case may be: http://stackoverflow.com/questions/14722486/check-if-android-version-is-less-than-4-with-phonegap

pauloborges commented 9 years ago

Yep, it happens in the demo I mentioned before. It works via Chrome.

Sivli-Embir commented 9 years ago

iOS 6 works fine with my patch both web and in Cordova. I am curious what happened in Android 5 to cause that. Regardless it looks like we need to detect for Cordova -> android -> version 5+ and if so require the css to load sync. Otherwise load async. Does that sound right?

pauloborges commented 9 years ago

Sorry, the problem was in my demo code. Now it's working.

Sivli-Embir commented 9 years ago

Awesome, thank you!