Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

map errors

$
0
0

Hi All,

Back again for more help. This time with getting the maps module installed and displaying for both Android and iOS.

filesystem

- modules
-- ti.ap
-- bluetooth (this works)
index.xml
<Window id="buddymap" title="Map">
         <Module id="map" module="ti.map" method="createView" platform="ios,android">
             <Button id="map_close" onClick="closeMap" right="0" width="10%" title="X" />
 
        </Module>   
    </Window>
the code
function buildMap(message){
//add some annotations, must be done in code
    if(message){
 
        var messageDetails = parsePushMessage(message);
 
        var anno1 = Alloy.Globals.Map.createAnnotation({
            title: messageDetails['title'], 
            latitude: messageDetails['lat'], 
            longitude: messageDetails['lon'],
              pincolor: Alloy.Globals.Map.ANNOTATION_RED
        });
        $.map.addAnnotation(anno1);
    }
    openMap(messageDetails);
}
 
 
function openMap(messgae){
    alert(alertString);
    $.buddymap.show();
}
 
function parsePushMessage(message){
 
    if ( Titanium.Platform.name == "android"){
        messageDetails['title'] = JSON.parse(message.payload).android.title;
        messageDetails['msg'] = JSON.parse(message.payload).android.title;
 
    }else{
        messageDetails['title'] = message.data.aps.title;   
    }
 
    var strLocation =JSON.parse( message ).loc;
    var arrayLocations = strLocation.split(",");
 
    messageDetails['lat']   =  arrayLocations[0];
    messageDetails['lng']   = arrayLocations[1];
 
    return messageDetails;
 
}
In my tiapp.xml, I do have the google api key for the maps.

So far, this code causes the app to crash on start up


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>