我們正在構建onsen ui和使用位置服務的混合應用程序。與iOS本機應用程序一樣,如果定位服務被禁用,則該溫泉應用程序應顯示彈出窗口,將重定向到設置 - >隱私頁面。以便該用戶可以啓用位置服務。在onsen用戶界面中打開移動GPS啓用設置頁面
我能夠檢測到GPS是否啓用,但我無法重定向到GPS啓用page.someone請幫助我重定向設置頁面在Android和IOS都。
代碼如下
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(
function(position)
{
init(position);
if (Location_Marker)
{
return;
}
Location_Marker = Add_Marker(position.coords.latitude,position.coords.longitude,"Initial Position");
},
function(error){
switch(error.code)
{
**case error.PERMISSION_DENIED:**
console.log("Permission Denied: ", error);
ons.notification.alert({message:'Please Enable GPS'});
break;
**case error.POSITION_UNAVAILABLE:**
console.log("POSITION_UNAVAILABLE: ", error);
ons.notification.confirm({message:'GPS signals are weak'});
break;
}
console.log("Something went wrong: ", error);
GeoLocation_Not_Supported();
},
);
}
如果被拒絕的權限我想打開手機設置頁面,這樣用戶就可以使用GPS
安置自己的代碼,以便我們可以幫助 – Akshay
功能(錯誤){ \t \t \t \t \t開關我會盡我的工作(error.code) \t \t \t \t \t { \t \t \t \t \t \t情況error.PERMISSION_DENIED: \t \t \t \t \t \t \t \t的console.log( 「權限被拒絕:」,錯誤); ons.notification.alert({message:'請啓用GPS'}); 休息; \t \t \t \t \t \t情況error.POSITION_UNAVAILABLE: \t \t \t \t \t \t \t \t的console.log( 「POSITION_UNAVAILABLE:」,錯誤); 0125.nn。確認({信息:'GPS信號弱'}); \t \t \t \t \t \t \t \t休息; \t \t \t \t \t} \t \t \t \t \t \t \t \t \t \t GeoLocation_Not_Supported(); \t \t \t \t}, –
如果PERMISSION_DENIED然後我想打開手機的設置頁面啓用GPS –