Example #1
0
 /// <summary>
 /// Setup the googleAPI client to help administer map and get the current location using Location Services
 /// </summary>
 private void clientSetup()
 {
     client = new GoogleApiClient.Builder(Android.App.Application.Context.ApplicationContext).AddConnectionCallbacks(this)
              .AddOnConnectionFailedListener(this)
              .AddApi(LocationServices.API).Build(); //create new client and add needed callbacks
     location = LocationServices.FusedLocationApi;   //initialize
     client.Connect();                               //conncet to the client on
 }
Example #2
0
        public override void OnCreate()
        {
            base.OnCreate();
            api = LocationServices.FusedLocationApi;
            if (prefs == null)
            {
                prefs = new PreferenceManager(this);
            }
            var thread = new HandlerThread("IntentService[BikrActivityService]");

            thread.Start();
            serviceLooper  = thread.Looper;
            serviceHandler = new ServiceHandler(this, serviceLooper);
        }
        public FusedLocationService()
        {
            _fusedLocationProviderApi = LocationServices.FusedLocationApi;
            _locationRequest          = new LocationRequest();
            _locationRequest.SetPriority(LocationRequest.PriorityHighAccuracy);
            _locationRequest.SetInterval(INTERVAL);
            _locationRequest.SetFastestInterval(FASTEST_INTERVAL);
            _googleApiClient = new GoogleApiClient.Builder(Application.Context)
                               .AddApi(LocationServices.API)
                               .AddConnectionCallbacks(this)
                               .AddOnConnectionFailedListener(this)
                               .Build();

            _googleApiClient?.Connect();
        }
 public static async Task <Statuses> SetMockModeAsync(this IFusedLocationProviderApi api, GoogleApiClient client, bool isMockMode)
 {
     return((await api.SetMockMode(client, isMockMode)).JavaCast <Statuses> ());
 }
 public static async Task <Statuses> SetMockLocationAsync(this IFusedLocationProviderApi api, GoogleApiClient client, global::Android.Locations.Location mockLocation)
 {
     return((await api.SetMockLocation(client, mockLocation)).JavaCast <Statuses> ());
 }
 public static async Task <Statuses> RequestLocationUpdatesAsync(this IFusedLocationProviderApi api, GoogleApiClient client, LocationRequest request, ILocationListener listener, Android.OS.Looper looper)
 {
     return((await api.RequestLocationUpdates(client, request, listener, looper)).JavaCast <Statuses> ());
 }
 public static async Task <Statuses> RequestLocationUpdatesAsync(this IFusedLocationProviderApi api, GoogleApiClient client, LocationRequest request, Android.App.PendingIntent callbackIntent)
 {
     return((await api.RequestLocationUpdates(client, request, callbackIntent)).JavaCast <Statuses> ());
 }
 public static async Task <Statuses> RemoveLocationUpdatesAsync(this IFusedLocationProviderApi api, GoogleApiClient client, ILocationListener listener)
 {
     return((await api.RemoveLocationUpdates(client, listener)).JavaCast <Statuses> ());
 }
 public static async Task <Statuses> RemoveLocationUpdatesAsync(this IFusedLocationProviderApi api, GoogleApiClient client, LocationCallback callback)
 {
     return((await api.RemoveLocationUpdates(client, callback)).JavaCast <Statuses> ());
 }
Example #10
0
 public override void OnCreate()
 {
     base.OnCreate ();
     api = LocationServices.FusedLocationApi;
     if (prefs == null)
         prefs = new PreferenceManager (this);
     var thread = new HandlerThread ("IntentService[BikrActivityService]");
     thread.Start ();
     serviceLooper = thread.Looper;
     serviceHandler = new ServiceHandler (this, serviceLooper);
 }
 public static PendingResult RequestLocationUpdates(this IFusedLocationProviderApi p, GoogleApiClient googleApiClient, LocationRequest locationRequest, LocationListener listener)
 {
     return(p.RequestLocationUpdates(googleApiClient, locationRequest, listener));
 }