[問題] Cordova 發送email問題
小弟用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裡面嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 172.118.183.92 (美國)
※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1570459370.A.66C.html
推
10/09 10:13,
5年前
, 1F
10/09 10:13, 1F
怎麼確定windows.plugins.email有載入?
另外這個windows 在Cordova是指裝置名稱嗎?
用瀏覽器測試是不是要改成browser.plugins.email?
※ 編輯: No3456p (172.58.30.219 美國), 10/10/2019 01:36:34
推
10/19 17:59,
5年前
, 2F
10/19 17:59, 2F
→
10/19 17:59,
5年前
, 3F
10/19 17:59, 3F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章