How to get my geolocation logs even my app close2019 Community Moderator ElectionHow to do logging in React Native?How to add icons to React Native appHow to get crash logs for React Native app?error “Could not get BatchedBridge, make sure your bundle is packaged properly” on start of appreact native get geolocation coordinate even in offline modeGetting the source of geolocation coordinatesHow to Keep user logged in react native using Asyncstorage even if i close the App?How to make socket-io work even after app closeKeep user logged in in app even after the app closed using Async StorageApp force close when get geolocation on release

NASA's RS-25 Engines

Can I negotiate a patent idea for a raise, under French law?

Finitely many repeated replacements

How do electrons receive energy when a body is heated?

Why couldn't the separatists legally leave the Republic?

Was it really inappropriate to write a pull request for the company I interviewed with?

When Schnorr signatures are part of Bitcoin will it be possible validate each block with only one signature validation?

Dynamic Linkage of LocatorPane and InputField

School performs periodic password audits. Is my password compromised?

Which situations would cause a company to ground or recall a aircraft series?

Why does Solve lock up when trying to solve the quadratic equation with large integers?

Is it a Cyclops number? "Nobody" knows!

Why does cron require MTA for logging?

Vocabulary for giving just numbers, not a full answer

What is the population of Romulus in the TNG era?

From an axiomatic set theoric approach why can we take uncountable unions?

What is this diamond of every day?

What is the purpose of "me" in "Je me suis trompé dans mon calcul."?

Does a difference of tense count as a difference of meaning in a minimal pair?

Source permutation

Street obstacles in New Zealand

I reported the illegal activity of my boss to his boss. My boss found out. Now I am being punished. What should I do?

Plausibility of Mushroom Buildings

Does Christianity allow for believing on someone else's behalf?



How to get my geolocation logs even my app close



2019 Community Moderator ElectionHow to do logging in React Native?How to add icons to React Native appHow to get crash logs for React Native app?error “Could not get BatchedBridge, make sure your bundle is packaged properly” on start of appreact native get geolocation coordinate even in offline modeGetting the source of geolocation coordinatesHow to Keep user logged in react native using Asyncstorage even if i close the App?How to make socket-io work even after app closeKeep user logged in in app even after the app closed using Async StorageApp force close when get geolocation on release










2















I want to get my location coordinate even app close. How do I do this ?



I use code which is below for get my location coordinate every 1 sec but it gives me always same coordinate. I dont know why it is not update.



even this is work, I cant get coordinate when app close. any idea about this ?



I did this :



 componentDidMount() 
this.interval = setInterval(() =>

navigator.geolocation.getCurrentPosition((position) =>
var lat = parseFloat(position.coords.latitude);
var lng = parseFloat(position.coords.longitude);

console.log("lat :",lat);
console.log("lng :",lng);

this.setState(position1: lat, position2: lng);

,
error => Alert.alert(error.message),
enableHighAccuracy: true, timeout: 30000, maximumAge: 1000
);

, 1000);


componentWillUnmount()
clearInterval(this.interval);










share|improve this question


























    2















    I want to get my location coordinate even app close. How do I do this ?



    I use code which is below for get my location coordinate every 1 sec but it gives me always same coordinate. I dont know why it is not update.



    even this is work, I cant get coordinate when app close. any idea about this ?



    I did this :



     componentDidMount() 
    this.interval = setInterval(() =>

    navigator.geolocation.getCurrentPosition((position) =>
    var lat = parseFloat(position.coords.latitude);
    var lng = parseFloat(position.coords.longitude);

    console.log("lat :",lat);
    console.log("lng :",lng);

    this.setState(position1: lat, position2: lng);

    ,
    error => Alert.alert(error.message),
    enableHighAccuracy: true, timeout: 30000, maximumAge: 1000
    );

    , 1000);


    componentWillUnmount()
    clearInterval(this.interval);










    share|improve this question
























      2












      2








      2


      2






      I want to get my location coordinate even app close. How do I do this ?



      I use code which is below for get my location coordinate every 1 sec but it gives me always same coordinate. I dont know why it is not update.



      even this is work, I cant get coordinate when app close. any idea about this ?



      I did this :



       componentDidMount() 
      this.interval = setInterval(() =>

      navigator.geolocation.getCurrentPosition((position) =>
      var lat = parseFloat(position.coords.latitude);
      var lng = parseFloat(position.coords.longitude);

      console.log("lat :",lat);
      console.log("lng :",lng);

      this.setState(position1: lat, position2: lng);

      ,
      error => Alert.alert(error.message),
      enableHighAccuracy: true, timeout: 30000, maximumAge: 1000
      );

      , 1000);


      componentWillUnmount()
      clearInterval(this.interval);










      share|improve this question














      I want to get my location coordinate even app close. How do I do this ?



      I use code which is below for get my location coordinate every 1 sec but it gives me always same coordinate. I dont know why it is not update.



      even this is work, I cant get coordinate when app close. any idea about this ?



      I did this :



       componentDidMount() 
      this.interval = setInterval(() =>

      navigator.geolocation.getCurrentPosition((position) =>
      var lat = parseFloat(position.coords.latitude);
      var lng = parseFloat(position.coords.longitude);

      console.log("lat :",lat);
      console.log("lng :",lng);

      this.setState(position1: lat, position2: lng);

      ,
      error => Alert.alert(error.message),
      enableHighAccuracy: true, timeout: 30000, maximumAge: 1000
      );

      , 1000);


      componentWillUnmount()
      clearInterval(this.interval);







      react-native






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 6 at 14:29









      hakanhakan

      887




      887






















          1 Answer
          1






          active

          oldest

          votes


















          1














          If the app is in the background or brought to the foreground, you might wanna take the advantage of AppState api and AppState.addEventListener('change', this._handleAppStateChange); see for the location change. If the app is closed, I am not quite sure if react native has an api watching location directly if the app is closed. However you can use react-native-queue to do this. You might wanna take a look at https://github.com/billmalarky/react-native-queue#os-background-task-full-example.






          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%2f55025464%2fhow-to-get-my-geolocation-logs-even-my-app-close%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









            1














            If the app is in the background or brought to the foreground, you might wanna take the advantage of AppState api and AppState.addEventListener('change', this._handleAppStateChange); see for the location change. If the app is closed, I am not quite sure if react native has an api watching location directly if the app is closed. However you can use react-native-queue to do this. You might wanna take a look at https://github.com/billmalarky/react-native-queue#os-background-task-full-example.






            share|improve this answer



























              1














              If the app is in the background or brought to the foreground, you might wanna take the advantage of AppState api and AppState.addEventListener('change', this._handleAppStateChange); see for the location change. If the app is closed, I am not quite sure if react native has an api watching location directly if the app is closed. However you can use react-native-queue to do this. You might wanna take a look at https://github.com/billmalarky/react-native-queue#os-background-task-full-example.






              share|improve this answer

























                1












                1








                1







                If the app is in the background or brought to the foreground, you might wanna take the advantage of AppState api and AppState.addEventListener('change', this._handleAppStateChange); see for the location change. If the app is closed, I am not quite sure if react native has an api watching location directly if the app is closed. However you can use react-native-queue to do this. You might wanna take a look at https://github.com/billmalarky/react-native-queue#os-background-task-full-example.






                share|improve this answer













                If the app is in the background or brought to the foreground, you might wanna take the advantage of AppState api and AppState.addEventListener('change', this._handleAppStateChange); see for the location change. If the app is closed, I am not quite sure if react native has an api watching location directly if the app is closed. However you can use react-native-queue to do this. You might wanna take a look at https://github.com/billmalarky/react-native-queue#os-background-task-full-example.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 6 at 16:59









                Subhendu KunduSubhendu Kundu

                1,285520




                1,285520





























                    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%2f55025464%2fhow-to-get-my-geolocation-logs-even-my-app-close%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