@Test public void generateAdUrl_whenLocationServiceGpsProviderHasMostRecentLocation_shouldUseLocationServiceValue() { Location locationFromDeveloper = new Location(""); locationFromDeveloper.setLatitude(42); locationFromDeveloper.setLongitude(-42); locationFromDeveloper.setAccuracy(3.5f); locationFromDeveloper.setTime(1000); ShadowLocationManager shadowLocationManager = Robolectric.shadowOf( (LocationManager) application.getSystemService(Context.LOCATION_SERVICE)); Location locationFromSdk = new Location(""); locationFromSdk.setLatitude(37); locationFromSdk.setLongitude(-122); locationFromSdk.setAccuracy(5.0f); locationFromSdk.setTime(2000); shadowLocationManager.setLastKnownLocation(LocationManager.GPS_PROVIDER, locationFromSdk); String adUrl = subject.withLocation(locationFromDeveloper) .generateUrlString("ads.mopub.com"); assertThat(getParameterFromRequestUrl(adUrl, "ll")).isEqualTo("37.0,-122.0"); assertThat(getParameterFromRequestUrl(adUrl, "lla")).isEqualTo("5"); assertThat(getParameterFromRequestUrl(adUrl, "llsdk")).isEqualTo("1"); }
@Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } WebViewAdUrlGenerator(Context context, boolean isStorePictureSupported); }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } WebViewAdUrlGenerator(Context context, boolean isStorePictureSupported); @Override String generateUrlString(String serverHostname); }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } WebViewAdUrlGenerator(Context context, boolean isStorePictureSupported); @Override String generateUrlString(String serverHostname);  }