Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

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.