How to set Location in android app Google maps using appium - java

I am testing google map for localization testing. I have to set location of except from my current location. But it is taking my current location.
Sample Code:
Location location = new Location(77.59974003, 12.91024781, 909);
driver.setLocation(location);

Try using the code which you have written for seting the location before the map is displayed.
Location location = new Location(77.59974003, 12.91024781, 909);
driver.setLocation(location);
This will set the driver location before the map is displayed on the screen.

Related

Can we allow our app user to add geofencing radius in android app?

I want to create an application that tracks childs location through firebase and implement geofence on that location. How do i initiate GeofenceClient with that location from firebase instead of my own location?
I have created an app that is fetching location from database of other user which is in latitude and logitude and can be converted to latlng datatype. I have also created feature of geofencing but heres the problem : This geofence check my location for geofence(i suppose this is happening because i have intiated geofence Client as //geofencingClient = LocationServices.getGeofencingClient(this);)
What should i do to pass the location of other user that i fetched from firebase in form of latitude and longitude in this geofencingClient.

How to get target location when using TrackerObjectQuad in Boofcv

I am using a tracker i.e
TrackerObjectQuad tracker = FactoryTrackerObjectQuad.circulant(null, GrayU8.class); and also TrackerObjectQuadPanel gui = new TrackerObjectQuadPanel(null); as gui for displaying results. I am setting the target as gui.setTarget(location, true);.
How can I get the target location?
One option was to get a low level tracker as here. I don't know how to use it.
Please tell me if there is any other option?

Google maps mark (current location) crashes the application, how to fix it?

I am trying to add current location mark to my android Google map application in Android Studio.
My code:
private void setUpMap() {
Location location = null;
LatLng loc = new LatLng(location.getLatitude(), location.getLongitude());
Marker marker;
marker = mMap.addMarker(new MarkerOptions().position(new LatLng((location.getLatitude()), location.getLongitude())).title("Marker"));}
It causes my application to crash. Underneath there are mistakes that appeared while running my application:
http://postimg.org/image/qrxdo9dl5/full/
(I used postimage to upload a larger size screen-shot)
Before I modified my code, I had a working code set to position 0,0:
private void setUpMap() {
mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
Then I tried to change location '0,0' to read current latitude and longitude and show it on my Google map. I changed my code based on this post: How to get the current location in Google Maps Android API v2?
I am a java beginner and any help is much appreciated. Thank you very much for any help.
You are getting a NullPointerException because your Location object is set to null. In the linked answer the location object comes from the location callback.
public void onMyLocationChange(Location location) // location object here
You can easily get the Location from your map reference like so
Location location = mMap.getMyLocation();
However this method is deprecated and using the location API is encouraged. To get location from the API you can follow this guide:
https://developer.android.com/training/location/retrieve-current.html
You build a GoogleApiClient, connect it, and then use it to get a location.
Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);

Spring Social for Facebook - get user location

I am using spring social Facebook to connect to facebook. The connection works well. I am trying to get the user's location with the following code:
FacebookProfile profile = facebook.userOperations().getUserProfile();
Reference rLocation = profile.getLocation();
Location location= facebook.fetchObject(rLocation.getId(), Location.class);
But what I get is an empty location object (it doesn't have any of the details). I can see that the rLocation does have a name (Los Angeles) but I also need the country.
Any idea how to get the actual Location object?
You can only get the location details that are a part of the Reference object which is the rLocation here. You can get the location city and location state but the location country is not a part of the Reference object.
Reference rLocation = profile.getLocation();
String locationName = rLocation.getName();
String[] cityAndState = locationName.split(",");
String city = cityAndState[0].trim();
String state = cityAndState[1].trim();
The Location object basically helps to get the details of a user checked in location in facebook. Please refer to the spring social facebook API for more details.
http://static.springsource.org/spring-social-facebook/docs/1.0.x/api/org/springframework/social/facebook/api/Location.html

Launch Google Maps from app

I have setup my app to launch Google maps to a set location using the code below, but the map displays zoomed full and you cant see any roads you have to zoom out manually to see anything. How can I set the zoom level with the code below I've tried setZoom(16); but this has no effect.
if (mapnav == 10) {
String uri = "geo: 53.777969,-1.571474";
setZoom(16);
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(i);}
Also can I launch into Directions instead of the map
You can specify a zoom level in your URI with for example "geo: 53.777969,-1.571474?z=23"
Google Maps
geo:latitude,longitude
geo:latitude,longitude?z=zoom
geo:0,0?q=my+street+address
geo:0,0?q=business+near+city
VIEW
Opens the Maps application to the given location or query. The Geo URI scheme (not fully supported) is currently under development.
The z field specifies the zoom level. A zoom level of 1 shows the whole Earth, centered at the given lat,lng. A zoom level of 2 shows a quarter of the Earth, and so on. The highest zoom level is 23. A larger zoom level will be clamped to 23.
For the google navigation part you can use "google.navigation:q="+location where location are the coordinates. The intent Intent.ACTION_VIEW.
Resources :
developer.android.com - Intents List: Invoking Google Applications on Android Devices
On the same topic :
Google Navigation (Android 1.6) intent callback

Categories