there is a couple of question I have,
first, as I read some of the articles, I should implement LocationListener, ConnectionCallback,OnConnectionFailedListener interfaces in the activity,
is it right to seperate the implementation of these classes in different files?
like below?
public class LocationListener implements
com.google.android.gms.location.LocationListener {
@Inject
Location mLastLocation;
@Override
public void onLocationChanged(Location location) {
// Assign the new location
mLastLocation = location;
// Displaying the new location on UI
}
}
is it right in my activity I handle Showing the mLastLocation properties?
//Fields
@Inject
GoogleApiClient client;
Location mLastLocation;
//Fields
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(client);
second, How should I write the provider method for it? , my guess will be like this, what will you guys recommend?
//Constructor
public LocationModule(Context context, GoogleApiClient.ConnectionCallbacks callback, GoogleApiClient.OnConnectionFailedListener listener) {
this.context = context;
this.callback = callback;
this.listener = listener;
}
@Provides
@Singleton
GoogleApiClient providesGoogleApi() {
return new GoogleApiClient.Builder(context)
.addOnConnectionFailedListener(listener)
.addConnectionCallbacks(callback)
.addApi(LocationServices.API)
.build();
}
and finally, where should I handle the permissions for android 6 and above devices?, is it on the view, or on the presenter?
I heard that View must be so stupid that you don't need to test it, How should I keep this principle?
If anyone can give me a reference, or github sample code, which matches my case that would be so great.