Spécifications:Construire Phonegap App n'initialise les cartes google
- PhoneGap Desktop App v0.4.3
- Android v5.1.1
Le code ci-dessus fonctionne bien avec application Desktop et Le fichier config.xml est créé par cette application de bureau PhoneGap. Et quand je l'ai essayé sur build.phonegap.com, Google maps n'a pas réussi à s'initialiser, donc, rien ne s'affiche sur Android, juste un écran blanc.
Voici ma méthode initMap qui l'API a besoin:
var map, directionsService, directionsDisplay;
function initMap() {
directionsService = new google.maps.DirectionsService;
directionsDisplay = new google.maps.DirectionsRenderer;
map = new google.maps.Map(document.getElementById('gMap'), {
zoom: 10,
center: { lat: 25.0115052, lng: 66.7845126 },
mapTypeId: 'roadmap',
});
directionsDisplay.setMap(map);
} // initMap() ends
config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.helloworld"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0">
<name>TestApp</name>
<description>
A blank PhoneGap app.
</description>
<author email="[email protected]" href="http://phonegap.com">
PhoneGap Team
</author>
<content src="index.html" />
<access origin="*" />
</widget>
Quelle erreur obtenez-vous exactement? – henrisycip
@henrisycip Je pense, je devrais refaire le problème (une application simple qui montre juste les google maps sans aucune modification). Je vais modifier la requête ci-dessus, après cela. –