Android Ultimate Plugin tutorial part 3 – GPS

Today we will show you on how to use GPS on our Android Ultimate Plugin.

Permission needed on your Android Manifest file without this it will not work or it will produce an error.

let’s start.

First we need to get the instance on the GPSPlugin

to stop the debugging toast messages from showing pass 0 on SetDebug() method

Next  setup the update interval and minimum meter change for GPS update

0 meter reason it’s a hack because LocationManager in android is a bit buggy and unreliable, this is force GPS to update more frequently

Then initialize our GPS plugin

After that we setup a  listener for OnLocationUpdate , OnEnable, OnGetLocationComplete and OnGetLocationFail Event From GPS

To Check if GPS is enable call CheckGPS() Method

To ask user to Enable GPS on Their device call ShowGPSAlert() Method

For Getting Latitude call GetLatitude() Method

For Getting Longitude call GetLongitude() Method

To get both Latitude and Longitude call GetLocation() method

or using GetLocationWithCallback method which triggers callback OnGetLocationComplete and OnGetLocationFail

To Stop listening from GPS event call StopGPS() Method

And That’s all , see this is so easy to use!

if you Guys encounter any problem or bugs or error, feel free to email us at gigadrillgames.com or you can comment below

Leave a Reply

Your email address will not be published. Required fields are marked *

*