我正在使用Ionic框架来构建我的移动应用程序,并且在使用CallNumber模块时,我一直在举杯,说“未发送呼叫”。在android上,我怀疑也是在ios上,但是每次通话都经过,并且使用了正确的电话号码。这是一个简短的代码段,显示了我使用CallNumber模块和Google Maps API所做的事情。这是该模块的文档:github.com/rohfosho/CordovaCallNumberPlugin
map.ts:
constructor(private navCtrl: NavController, private platform: Platform, private geolocation: Geolocation,
private callNumber: CallNumber, private toast: Toast) {
}
let prompt = {
title: place.name,
address: place.formatted_address,
phone: place.formatted_phone_number,
open_closed: (place.opening_hours.open_now ? "Open": "Closed"),
opening_closing_time: (place.opening_hours.open_now ? "Closes " + time: "Opens " + time + daysOfTheWeek[day]),
distance: distance
};
scopeObj.places.push(prompt);
scopeObj.infoWindow = new google.maps.InfoWindow({
maxWidth: 250
});
marker.addListener('click', function() {
document.getElementById("phone").addEventListener("click", function() {
for (var i = 0; i < scopeObj.places.length; i++) {
if (scopeObj.infoWindow.content.includes(scopeObj.places[i].address)) {
scopeObj.toast.show(`Sending Call`, '2000', 'center');
scopeObj.callNumber.callNumber(scopeObj.places[i].phone, true);
break;
}
}
});