Adding Background Geolocation to an Ionic 2 Application



By - Josh Morony

In a previous tutorial, I have demonstrated how to use Geolocation in an Ionic 2 application. The method used in that tutorial is the “standard” way to use the Geolocation plugin, it will allow you to grab the users current position, or watch their position over time whilst they have the app open.

That is useful in a lot of circumstances, but you may want to access the devices GPS over a long period of time, including when the user closes your application. When using the standard Geolocation plugin, as soon as the user exits the application you lose your ability to track them.

This is a problem I have faced before, and it popped its head up again recently since I am currently building an Ionic 2 application that tracks how far a user has run, and I don’t expect the user to keep the app open the entire time they are running (which would be pretty awkward).


In this tutorial I am going to show you how you can enable Background Geolocation in your Ionic 2 applications. This means that you will be able to continue tracking a users location, and executing code in your application, even when the user closes your application.

Read full article..

Share on Google Plus

About www. codeandyou.com

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment