Injection of GoogleApiClient

Viewed 1025

I want to inject to instances of Google api client in different parts of my project however I haven't manage to make it work.

@Provides @Named("geodata_api")
    @Singleton
    GoogleApiClient providesGoogleApiClient(Context context) {
            return new GoogleApiClient.Builder(context)
                    .addApi(Places.GEO_DATA_API)
                    .build();
        }

  @Provides @Named("location_api")
    @Singleton
    GoogleApiClient providesGoogleApiClient(Context context) {
        return new GoogleApiClient.Builder(providesContext())
                .addApi(LocationServices.API)
                .build();
    }
1 Answers
Related