Set OSMDroid UserAgent

This commit is contained in:
Daniele 2021-11-22 08:55:35 +01:00
parent fd14eea4b9
commit 83b3b8a48d
2 changed files with 7 additions and 3 deletions

View File

@ -10,8 +10,8 @@
{ {
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"versionCode": 3, "versionCode": 5,
"versionName": "0.3.1", "versionName": "0.3.3",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
] ]

View File

@ -43,6 +43,7 @@ import androidx.preference.PreferenceManager;
import org.osmdroid.api.IMapController; import org.osmdroid.api.IMapController;
import org.osmdroid.config.Configuration; import org.osmdroid.config.Configuration;
import org.osmdroid.config.IConfigurationProvider;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.CustomZoomButtonsController; import org.osmdroid.views.CustomZoomButtonsController;
import org.osmdroid.views.overlay.Marker; import org.osmdroid.views.overlay.Marker;
@ -53,6 +54,7 @@ import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import it.danieleverducci.nextcloudmaps.BuildConfig;
import it.danieleverducci.nextcloudmaps.R; import it.danieleverducci.nextcloudmaps.R;
import it.danieleverducci.nextcloudmaps.activity.main.MainActivity; import it.danieleverducci.nextcloudmaps.activity.main.MainActivity;
import it.danieleverducci.nextcloudmaps.activity.main.MainActivityViewModel; import it.danieleverducci.nextcloudmaps.activity.main.MainActivityViewModel;
@ -81,8 +83,10 @@ public class GeofavoriteDetailActivity extends AppCompatActivity implements Loca
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// OSMDroid config // OSMDroid config
Configuration.getInstance().load(getApplicationContext(), IConfigurationProvider osmdroidConfig = Configuration.getInstance();
osmdroidConfig.load(getApplicationContext(),
PreferenceManager.getDefaultSharedPreferences(getApplicationContext())); PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));
osmdroidConfig.setUserAgentValue(BuildConfig.APPLICATION_ID);
mViewHolder = new ViewHolder(getLayoutInflater()); mViewHolder = new ViewHolder(getLayoutInflater());
setContentView(mViewHolder.getRootView()); setContentView(mViewHolder.getRootView());