@Test public void generateAdUrl_whenDeveloperSuppliesMoreRecentLocationThanLocationService_shouldUseDeveloperSuppliedLocation() { 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 olderLocation = new Location(""); olderLocation.setLatitude(40); olderLocation.setLongitude(-105); olderLocation.setAccuracy(8.0f); olderLocation.setTime(500); shadowLocationManager.setLastKnownLocation(LocationManager.GPS_PROVIDER, olderLocation); String adUrl = subject.withLocation(locationFromDeveloper) .generateUrlString("ads.mopub.com"); assertThat(getParameterFromRequestUrl(adUrl, "ll")).isEqualTo("42.0,-42.0"); assertThat(getParameterFromRequestUrl(adUrl, "lla")).isEqualTo("3"); assertThat(getParameterFromRequestUrl(adUrl, "llsdk")).isEmpty(); }
@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);  }