How to show my current location in Google Map? - android

I know that this question was asked before, I want to display my current location in a google map.So, I tried to follow the steps in this tutorial Getting Started With Google Maps for Android: Basics
In step 3: Configuring the Map, I had this error:
I add this line because android asked me to call requires permission which may be rejected by user:code should explicitly chek to see if permission is available
Thanks.

Instead of passing this pass getActivity()

Related

react-native-google-places ERROR making places detection api call: ERROR

this is the code that the docs in the googleplace but this is happend
ERROR making places detection api call: ERROR
RNGooglePlaces.getCurrentPlace()
.then((results) => alert(results))
.catch((error) => alert(error.message));
According to this GitHub issue, assuming you're using tolu360's react-native-google-places library, you should check the following:
Ensure device's GPS location is on.
Ensure you have asked for (and received) ACCESS_FINE_LOCATION permission.
Ensure you are using a real device, not an emulator.
Since you need a specific place, you need a real device with the ability to report it's location, and permission to access that information!
On line 363 of RNGooglePlacesModule.java inside the library, you can add a breakpoint to see the actual error returned by likelyPlaces.getStatus(). I suggest you do this and add any extra information into your question.

Is it possible to get the "Popular times" information through the Google Places API

Is it possible to get the "Popular times" information through the Google Places API or any other API? I need this information to be displayed in my application for a particular place.
This is one of the top feature requests in Google issue tracker (more than 500 stars):
https://issuetracker.google.com/issues/35827350
Currently, the state is Assigned, however, no any ETA provided by Google. Please star it to get further updates.
I haven't managed to test it myself but this is what populartimes offers to do in Python:
import populartimes
populartimes.get("your-api-key", ["bar"], (48.132986, 11.566126), (48.142199, 11.580047))
More info on developer's github.
It's possible to scrape it, but it violates the Google ToS.
yes its possible but as said it violates googles ToS ,
i have used npm package busy-hours but it's not working so i have modified their code and here is new npm package
https://www.npmjs.com/package/google-busy-hours

To use or not to use getMyLocation () in google maps API v2 for android?

I'm currently working on an application that takes advantage of some simple features of the google maps api v2. This application is supposed to find user's current location and then display some places of my choice which also should be near to the user.
I've already achieved to find and display user location. The thing is that it seems that getMyLocation() (which I'm currently using) is deprecated, acording to android's developer site. However, Eclipse is not showing any kind of warning sign of deprecation for this method. I didn't knew this at the time I started writing my code.
So my question is: should I be worried for this to be a problem in the future if I plan to publish my app?
Here's my code for moving into user location:
if (map.getMyLocation() != null) {
Toast.makeText(this, "You are here", Toast.LENGTH_LONG).show();
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(
map.getMyLocation().getLatitude(), map.getMyLocation()
.getLongitude()), 15));
}
Thank you very much in advance for your time and your answers.
As said in the documentation, it is deprecated.
Try to use a LocationClient implementation instead.
http://developer.android.com/reference/com/google/android/gms/location/LocationClient.html
You can enable the "my location layer" available on maps V2.
map.setMyLocationEnabled (true)
check:
http://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.html#setMyLocationEnabled%28boolean%29

Android: Automatic User Locatio

I am working on the developement of an android app. I need to locate the user without displaying the map (only the name of his location ei New york, USA)
I work using Eclipse SDK.
Is there a way to do it?
Thanks :)
Ps: I am new to android
Android API Maps
In the API documentation it shows you step by step how to get started on this
type of application.
How to get started
One thing you have to remember is that the user must enable
the GPS to get current location
Since you explained in comments that you already know how to get the Location, and thus the latitude and longitude, you can resolve it to an address using Android's GeoCoder class, with its getFromLocation(double,double,int) method.

Map not being displayed after refactoring to change the name of the project and package

I'm close to finish my first app so I change its name and the corresponding packages. To do so, I used the Android Tools from Eclipse and everything works after one or two attemps (there where a couple of things that I had to change manually), but in general, following the comments from this response, there were not further problems. Except for the Google Maps. Now they are not being displayed anymore and I'm getting the following error:
Google Maps Android API(12251): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I know that there is no connection problem because I'm getting other kind of info from the internet and because the following sentence is true:
int availabilityCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(availabilityCode == ConnectionResult.SUCCESS){
The first thing that I did was to go to the Google API and change the package name in the place where you generate the key to make it match the new one. That didn't work, so I deleted the key and created a new one. I pasted the new API key in the Android Manifest but it is not working. Any clues? I'm missing any steps?
In the manifest I still have the needed permissions set, like
<permission
android:name="com.alvarosantisteban.pathos.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
etc.
I think it was a combination of the three things commented here:
That the api key was not valid anymore (but when I posted the question, I already had that done, as I mentioned on it)
But specially that I had to clean the data. I actually deleted the app, because, thanks to the help of android_hungry I went to check my apps and saw that my app appeared two times, one with the maps workings and the other one, the one that is on my desktop as a shortcut, not.
Additionally, it might have happened what silver_man mentioned, I'm not sure.
Thanks to all for the help. :)
You have to create a new api key, as the fingerprint is made from your package name. https://developers.google.com/maps/documentation/android/start?hl=es#obtaining_an_api_key

Categories

Resources