@@ -0,0 +1,2190 @@
+package com.andela.motustracker.model;%0A%0Aimport android.content.Context;%0Aimport android.content.pm.PackageManager;%0Aimport android.location.Location;%0Aimport android.os.Bundle;%0Aimport android.support.v4.content.ContextCompat;%0Aimport android.util.Log;%0A%0Aimport com.andela.motustracker.helper.GoogleClient;%0Aimport com.andela.motustracker.helper.NotifyServiceLocation;%0Aimport com.google.android.gms.common.ConnectionResult;%0Aimport com.google.android.gms.common.api.GoogleApiClient;%0Aimport com.google.android.gms.location.LocationServices;%0A%0A%0Apublic class LocationHandler implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener %7B%0A%0A%0A    private static final String TAG = %22LocationHandler%22;%0A%0A    private Location mLastLocation;%0A    private GoogleApiClient mGoogleApiClient;%0A%0A    private Context context;%0A    private NotifyServiceLocation notifyServiceLocation;%0A%0A    public LocationHandler(Context context, NotifyServiceLocation notifyServiceLocation) %7B%0A        this.context = context;%0A        this.notifyServiceLocation = notifyServiceLocation;%0A        prepareService();%0A    %7D%0A%0A    public synchronized void prepareService() %7B%0A       mGoogleApiClient = GoogleClient.getInstance(context,this,this).getGoogleApiClient();%0A    %7D%0A%0A    /**%0A     * Google api callback methods%0A     */%0A    @Override%0A    public void onConnectionFailed(ConnectionResult result) %7B%0A        Log.i(TAG, %22Connection failed: ConnectionResult.getErrorCode() = %22 + result.getErrorCode());%0A    %7D%0A%0A    @Override%0A    public void onConnected(Bundle arg0) %7B%0A        // Once connected with google api, get the location%0A        int permissionCheck = ContextCompat.checkSelfPermission(context,%0A                android.Manifest.permission.ACCESS_FINE_LOCATION);%0A%0A        if (permissionCheck == PackageManager.PERMISSION_GRANTED) %7B%0A            mLastLocation = LocationServices.FusedLocationApi.getLastLocation(%0A                    mGoogleApiClient);%0A        %7D%0A        if (mLastLocation != null) %7B%0A            //callback%0A            notifyServiceLocation.getLocationCallBack(mLastLocation);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void onConnectionSuspended(int i) %7B%0A        mGoogleApiClient.connect();%0A    %7D%0A%7D%0A

Implement Location handler to handle location