[問題] Cordova 發送email問題

作者: No3456p (No)   2019-10-07 22:42:45
小弟用cordova 發送email出現問題
Code:
$(document).ready(function(){
var myVar;
var myVar2;
var x = document.getElementById("demo");
var location =[];
var y;
var n;
var i;
var a;
$("#start").click(function(){
GPSfind();
});
$("#end").click(function(){
end1();
console.log(location);
window.plugins.email.open({
to: [''],
cc: [''],
bcc: [''],
subject: 'GPS location',
body: '<p>'+location+'</p>',
isHtml: true
});
});
function end1(){
clearInterval(myVar);
}
function GPSfind() {
myVar = setInterval(getLocation, 3000);
}
unction getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
var d = new Date();
n = d.toLocaleString();
y="time:"+n+"Latitude: " + position.coords.latitude + "Longitude: " +
position.coords.longitude;
location.push(y);
}
});
卡在用browser測試的時候抓不到cordova.plugins.email.open
https://www.npmjs.com/package/cordova-plugin-email
document.addEventListener('deviceready', function () {
// cordova.plugins.email is now available
}, false);
問題
1.用Cordova 開發app時,是js code 都要放在add Event Listener裡面嗎?
作者: ccvs (kisS x Sis)   2019-10-09 10:13:00
你確定windows.plugins.email 有載入嗎?
作者: kir7741 (Domo)   2019-10-19 17:59:00
Browser 不能用 nativeBrowser 請用 mailto

Links booklink

Contact Us: admin [ a t ] ucptt.com