android - Cordova geolocation not working on android5 -
i'm using cordova geolocation plugin. added geolocation plugin app. when run application see white page. app doesnt work. tried emulator , on device result not different. tried device again result white page. before looked questions , tried different solving way not working. please me. want solve problem.
İt index.html
<!doctype html> <html> <head> <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;"> <meta name="format-detection" content="telephone=no"> <meta name="msapplication-tap-highlight" content="no"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> <link rel="stylesheet" type="text/css" href="css/index.css"> <title>hello world</title> </head> <body> <div id="map"></div> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="js/index.js"></script> <script src="https://maps.googleapis.com/maps/api/js?key=aizasyc18ssj3hw71l5zkmybhqbrmxqxwycglo8"></script> </body> </html>
İt index.js
var app = { initialize: function() { document.addeventlistener('deviceready', this.ondeviceready.bind(this), false); }, ondeviceready: function() { navigator.geolocation.getcurrentposition(app.onsuccess, app.onerror, app.options); }, onsuccess:function(position) { var lat=position.coords.latitude; var lng=position.coords.longitude; var latlong=new google.maps.latlng(lat,lng); var mapoptions={ center:latlong, zoom:13, maptypeid:google.maps.maptypeid.roadmap }; var map=new google.maps.map(document.getelementbyid("map"),mapoptions); var marker=new google.maps.marker({ position:latlong, map:map, title:'location' }) }, onerror:function (error) { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } }; app.initialize();
İt config.xml
<?xml version='1.0' encoding='utf-8'?> <widget id="com.example.geox" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>geox</name> <description> sample apache cordova application responds deviceready event. </description> <author email="dev@cordova.apache.org" href="http://cordova.io"> apache cordova team </author> <content src="index.html" /> <plugin name="cordova-plugin-whitelist" spec="1" /> <access origin="*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <platform name="android"> <allow-intent href="market:*" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform> </widget>
İt res/xml/config.xml
<?xml version='1.0' encoding='utf-8'?> <widget id="com.example.geox" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <feature name="geolocation"> <param name="android-package" value="org.apache.cordova.geolocation.geolocation" /> </feature> <feature name="whitelist"> <param name="android-package" value="org.apache.cordova.whitelist.whitelistplugin" /> <param name="onload" value="true" /> </feature> <feature name="notification"> <param name="android-package" value="org.apache.cordova.dialogs.notification" /> </feature> <name>geox</name> <description> sample apache cordova application responds deviceready event. </description> <author email="dev@cordova.apache.org" href="http://cordova.io"> apache cordova team </author> <content src="index.html" /> <access origin="*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <allow-intent href="market:*" /> <preference name="loglevel" value="debug" /> </widget>
Comments
Post a Comment