Open GPS enable setting page of mobile in onsen UI



  • Open GPS enable setting page of mobile in onsen UI

    Hello Everyone ,

    I am facing a problem,someone Please help me.

    We are building hybrid application on onsen UI in Monaca IDE and using location service. Like in iOS Native app If Location service is disabled, the onsen app should show popup that will redirect to setting->privacy page. So that user can enable location service.

    i am able to detect that GPS is enable or not but i am unable to redirect to GPS enable page.someone please help me to redirect setting page in Android and IOS both.

    code is Below

    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();
            }, 
    
        );
    
    }
    

    if Permission Denied i want to open mobile setting page so that user can enable GPS.