Quick question regarding Google Maps. I have one fully working Google Maps project and another working project for my main application. I am wondering about combining these. How does one go about doing adding the Google Maps API functionality to the existing Android project.
I have tried researching this online but my search terms seemed to be a bit ambiguous.
Thanks.
Assuming you are using a Single MapActivity, copy that activity to the other project and change the Target Platform for the existing android project to Google API <VersionNo>
Add the Maps API library to your project's Manifest file
<uses-library android:name="com.google.android.maps" />
Obtain the Maps API key, add to your project and also sign the app with the certificate corresponding to the same key
http://code.google.com/android/add-ons/google-apis/mapkey.html
You can easily integrate Google maps with a Maps view into your application.
But make sure you to sign your application with the key that was used for receiving the google maps api key. Otherwise nobody will see the maps when your application is published.
If you have the plugin
Go to:
project,
properties,
android,
on the right hand menu choose the google api of your choice
the library will be added to your project.
Remember you must add the appropriate xml resource from your project and the permissions to your manifest etc
Related
I was tiring to build an app which uses google maps for showing places and Pace API for searching places. but it is not being possible to build the app with two different API keys in the manifest. So, I want to Know if it is possible to access both Maps and Place API with the same API key..? or There is some other way for doing this.
Yes! you can use same key on both of and also you can use only one key for all Google API
See below image in listed all google api and see this link.
Now you have to Enable all of api, Here must enable API you have require in your app. see this
Note: You have to create API key for particular platform different platform for different API key you have to create. See below image
Now get Stared with this Link
First of all go to Google Api Console and select your project
And select api you want to enable like google Map Api or google place api. Enable your api.
Add api key in application tag of Manifest like
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/map_api_key" />
if you are using both Map and Geo Api.then only add geo api(it will work for both)
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/place_api_key" />
you have to create a project in Google Console
then enable both api Google Map and Google Places API From Google Console
and use that projects key in manifest. both api work fine.
yes you can use same key for both services
http://javapapers.com/android/find-places-nearby-in-google-maps-using-google-places-apiandroid-app/
https://examples.javacodegeeks.com/android/android-google-places-api-example/
Yes you can use the Same Key for Both Functionality.
Note : Make sure when you Create API Key You need to Enable both API Google Map and Google Places API.
From Google Console. Where you have Created your Project. That's It.
After that Both API will Work with Single API Key.
EDIT 1:
Create Project using this Link If you havn't Created your Project in Google Console.
Then after select created project from list of projects you have.
It will show you All the APIS List. From that Enable APIS which you need to use in your Project.
Then add your Generated API Key in Manifest Android. That's It.
I have a library which makes use of Google Maps. When I give out this library how do I handle the api key scenario and registration of the client app on my google dashboard for the maps to be loaded on the android app?
Is there a way that I don't manage the maps and the client using my library just does it?
So, the solution was pretty easy.
What needs to be done is remove the mention of the API key in the manifest of the library. And ask the one implementing the library to put an API key the application module's manifest.
This is a very good solution as this takes away all the headache of management of the API key from the library and gives the handle directly to the user of the library.
Many thanks to Christophe Beyls for the solution.
I am following https://developers.google.com/identity/sign-in/android/start-integrating guide to integrate google Sign-in into my android app.
I am working on a project where Its not possible for me to put configuration file into app folder of android project. I want to know is there any alternative for that. Can I put API key in the AndroidManifest.xml as a meta-data tag under application tag instead of putting google-services.json in app directory as allowed with Google map API (reference https://developers.google.com/maps/documentation/android/start#add_the_api_key_to_your_application) ?
I also want to know where the configuration file (google-services.json) is used in android app because its not present in generated apk?
There is no need for putting meta-data tag containing API key for Google plus sign in Android api. Just need to take care that correct SHA-1 key is put in credentials.
There is no need to put configuration file for using Google plus android api. Its not used by android app at all.
Generally created in android studio, a custom application MapActivity, already 4:00 I get it I can not nastroit.V file "google_maps_api.xmp" put the key that was commented above
To get one, follow this link, follow the directions and press "Create" at the end: https://console.developers.google.com/flows/enable... You can also add your credentials to an existing key, using this line: D0:27:4F:13:7E:3A:0A:85:36:D5:4D:44:31:DC:6F:8A:02:7E:5C:3B;com.example.dd.map Once you have your key (it starts with "AIz"), replace the google_maps_key string in this file
that's the key "AIz" I bet when you run applications run tools for viewing Google maps (zoom, zoom out), but the card will not run? Maybe it is necessary to connect to the file, and if so, how? And then how to put all the lessons Google maps, but they are all old, and how to configure them is not written anywhere, and they are all old, tell me how to make what they were loaded?
Have you enabled the Android Google Maps API for your app from developers console? https://console.developers.google.com/ ? That should be the first step. You can do that with the code you have pasted. You can replace the API key (starting with "Alz" . Once you do that, the MapActivity will start working. You should also have google play services enabled. Make sure these are mentioned as dependencies in your gradle build files. Check this thread Android Google Mapview Activity not opening in Android Studio
So I have been having problems getting maps to work on my project and could not figure out why it wouldn't work, so I tested out the maps test application that comes in the services add on for Android Studio but just the menu will work and it still gives me a blank screen for the map even though it shows no errors.
This is a very vague question, I know, but is there something I'm missing?
Did you get an API key for your application?
From https://developers.google.com/maps/documentation/android/intro#sample_code:
Add your own Google Maps Android API key. The package name for the demo app is com.example.mapdemo. Note that the demo app already includes an API key in its manifest file. You will need to replace the key with your own API key.