ionic 3 geolocation not working on real device





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-1















Geo location Code for ionic :



this.geolocation.getCurrentPosition().then( pos =>{

this.lat = pos.coords.latitude;
this.long = pos.coords.longitude;
}).catch(err => this.presentToast(err));









share|improve this question

























  • Need more Information, Please Share your ionic details and Plugin details.

    – Najam us saqib
    Jan 3 at 12:18











  • I am using @ionic-native/geolocation plugin and ionic 3

    – snigdha
    Jan 3 at 13:17











  • did you allow location permission on device?

    – Najam us saqib
    Jan 3 at 13:18











  • yes I am allow location permission

    – snigdha
    Jan 3 at 13:36











  • what error you getting?

    – Najam us saqib
    Jan 3 at 13:37


















-1















Geo location Code for ionic :



this.geolocation.getCurrentPosition().then( pos =>{

this.lat = pos.coords.latitude;
this.long = pos.coords.longitude;
}).catch(err => this.presentToast(err));









share|improve this question

























  • Need more Information, Please Share your ionic details and Plugin details.

    – Najam us saqib
    Jan 3 at 12:18











  • I am using @ionic-native/geolocation plugin and ionic 3

    – snigdha
    Jan 3 at 13:17











  • did you allow location permission on device?

    – Najam us saqib
    Jan 3 at 13:18











  • yes I am allow location permission

    – snigdha
    Jan 3 at 13:36











  • what error you getting?

    – Najam us saqib
    Jan 3 at 13:37














-1












-1








-1








Geo location Code for ionic :



this.geolocation.getCurrentPosition().then( pos =>{

this.lat = pos.coords.latitude;
this.long = pos.coords.longitude;
}).catch(err => this.presentToast(err));









share|improve this question
















Geo location Code for ionic :



this.geolocation.getCurrentPosition().then( pos =>{

this.lat = pos.coords.latitude;
this.long = pos.coords.longitude;
}).catch(err => this.presentToast(err));






ionic3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 14:04









Najam us saqib

699617




699617










asked Jan 3 at 12:12









snigdha snigdha

92




92













  • Need more Information, Please Share your ionic details and Plugin details.

    – Najam us saqib
    Jan 3 at 12:18











  • I am using @ionic-native/geolocation plugin and ionic 3

    – snigdha
    Jan 3 at 13:17











  • did you allow location permission on device?

    – Najam us saqib
    Jan 3 at 13:18











  • yes I am allow location permission

    – snigdha
    Jan 3 at 13:36











  • what error you getting?

    – Najam us saqib
    Jan 3 at 13:37



















  • Need more Information, Please Share your ionic details and Plugin details.

    – Najam us saqib
    Jan 3 at 12:18











  • I am using @ionic-native/geolocation plugin and ionic 3

    – snigdha
    Jan 3 at 13:17











  • did you allow location permission on device?

    – Najam us saqib
    Jan 3 at 13:18











  • yes I am allow location permission

    – snigdha
    Jan 3 at 13:36











  • what error you getting?

    – Najam us saqib
    Jan 3 at 13:37

















Need more Information, Please Share your ionic details and Plugin details.

– Najam us saqib
Jan 3 at 12:18





Need more Information, Please Share your ionic details and Plugin details.

– Najam us saqib
Jan 3 at 12:18













I am using @ionic-native/geolocation plugin and ionic 3

– snigdha
Jan 3 at 13:17





I am using @ionic-native/geolocation plugin and ionic 3

– snigdha
Jan 3 at 13:17













did you allow location permission on device?

– Najam us saqib
Jan 3 at 13:18





did you allow location permission on device?

– Najam us saqib
Jan 3 at 13:18













yes I am allow location permission

– snigdha
Jan 3 at 13:36





yes I am allow location permission

– snigdha
Jan 3 at 13:36













what error you getting?

– Najam us saqib
Jan 3 at 13:37





what error you getting?

– Najam us saqib
Jan 3 at 13:37












1 Answer
1






active

oldest

votes


















0














1) we have to install a compatible version of the plugin, in my case it was
"@ionic-native/geolocation": "^4.4.2",



2) we have to put it in the packaje.json denpendencies
just copy this version to the packaje in my case it was 4.4.2



3) we have to run this cmd to take off node_modules after reinstall it like that
rm -rf node_modules/



4) after you have to clean the cache before to install
npm cache clean --force



5) now reinstall the node_module by running this cmd command
npm install



6) in my case i m using visual studio IDE i had problem with storage,i resolved with
a lil trick but i don't know why, just take off the storage with ctrl + x and put it back again ctrl + v. and ready to use my app.



and one morething in ur mobile you have to give the gps permission to be able to use it.



hope this help you






share|improve this answer


























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022066%2fionic-3-geolocation-not-working-on-real-device%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    1) we have to install a compatible version of the plugin, in my case it was
    "@ionic-native/geolocation": "^4.4.2",



    2) we have to put it in the packaje.json denpendencies
    just copy this version to the packaje in my case it was 4.4.2



    3) we have to run this cmd to take off node_modules after reinstall it like that
    rm -rf node_modules/



    4) after you have to clean the cache before to install
    npm cache clean --force



    5) now reinstall the node_module by running this cmd command
    npm install



    6) in my case i m using visual studio IDE i had problem with storage,i resolved with
    a lil trick but i don't know why, just take off the storage with ctrl + x and put it back again ctrl + v. and ready to use my app.



    and one morething in ur mobile you have to give the gps permission to be able to use it.



    hope this help you






    share|improve this answer






























      0














      1) we have to install a compatible version of the plugin, in my case it was
      "@ionic-native/geolocation": "^4.4.2",



      2) we have to put it in the packaje.json denpendencies
      just copy this version to the packaje in my case it was 4.4.2



      3) we have to run this cmd to take off node_modules after reinstall it like that
      rm -rf node_modules/



      4) after you have to clean the cache before to install
      npm cache clean --force



      5) now reinstall the node_module by running this cmd command
      npm install



      6) in my case i m using visual studio IDE i had problem with storage,i resolved with
      a lil trick but i don't know why, just take off the storage with ctrl + x and put it back again ctrl + v. and ready to use my app.



      and one morething in ur mobile you have to give the gps permission to be able to use it.



      hope this help you






      share|improve this answer




























        0












        0








        0







        1) we have to install a compatible version of the plugin, in my case it was
        "@ionic-native/geolocation": "^4.4.2",



        2) we have to put it in the packaje.json denpendencies
        just copy this version to the packaje in my case it was 4.4.2



        3) we have to run this cmd to take off node_modules after reinstall it like that
        rm -rf node_modules/



        4) after you have to clean the cache before to install
        npm cache clean --force



        5) now reinstall the node_module by running this cmd command
        npm install



        6) in my case i m using visual studio IDE i had problem with storage,i resolved with
        a lil trick but i don't know why, just take off the storage with ctrl + x and put it back again ctrl + v. and ready to use my app.



        and one morething in ur mobile you have to give the gps permission to be able to use it.



        hope this help you






        share|improve this answer















        1) we have to install a compatible version of the plugin, in my case it was
        "@ionic-native/geolocation": "^4.4.2",



        2) we have to put it in the packaje.json denpendencies
        just copy this version to the packaje in my case it was 4.4.2



        3) we have to run this cmd to take off node_modules after reinstall it like that
        rm -rf node_modules/



        4) after you have to clean the cache before to install
        npm cache clean --force



        5) now reinstall the node_module by running this cmd command
        npm install



        6) in my case i m using visual studio IDE i had problem with storage,i resolved with
        a lil trick but i don't know why, just take off the storage with ctrl + x and put it back again ctrl + v. and ready to use my app.



        and one morething in ur mobile you have to give the gps permission to be able to use it.



        hope this help you







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 28 at 15:04









        Gaslan

        6681421




        6681421










        answered Jan 28 at 13:30









        blackwolfblackwolf

        1




        1
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022066%2fionic-3-geolocation-not-working-on-real-device%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            Npm cannot find a required file even through it is in the searched directory