7/21/2023 0 Comments Us map google map snapshotAfter enabling this API, you have to check your credentials.After choosing Google Maps Android APIs, you will be taken to Google Maps Android API dashboard where you have to Enable API as shown below.Select the API that you want to use in your project. After project is created, you will be directed to API manager page.Google will generate a new Unique ID for your project as shown below. Better use the same name that you used to create Xamarin Forms solution. Navigate to the following link, sign in with your Google account and create a project as shown in the screenshot.Doing so will add the Google Maps Android API v2 to your project. After you have generated SHA-1, create a new project in Google APIs console. Please take note of the SHA-1 address.You can now find the certificate fingerprint that is to be used while generating API key of Google Maps. Following screenshot is the result of executing command in Command Prompt.JDK version may be different on your PC and you need to verify it by following the path written above. " C:\Program Files (x86)\Java\jdk1.7.0_71\bin\keytool.exe" -list -v -keystore "%LocalAppData% \Xamarin\Mono for Android\debug.keystore" -alias androiddebugkey -storepass android -keypass android To generate SHA-1 fingerprint of debug.keystore file, open command prompt and write the following command and hit enter.Keytool -list -v -keystore -alias -storepass -keypass Keytool needs the following command to generate SHA-1 fingerprint.Windows - C:\Program Files (x86)\Java\jdk\bin\keytool.exe Information about a keystore file is needed to know about SHA-1 fingerprint and this is done by running a keytool command from the jdk.Windows - C:\Users\\AppData\Local\Xamarin\Mono for Android\debug.keystore KeyStore is a file that is used to sign application and can be used in both debugged and released builds.To request API key from Google, you will have to generate SHA-1 fingerprint of debug.keystore file which can be found at the following path. To generate API key, you need to register with Google Maps API by creating a project in Google API console.This task is going to be the heart of your project and needs to be performed carefully. To use Google Maps API, you must generate an API key and add it to your project. In this section, let us implement API call for Android project.You must pass the same parameters as Forms.Init in MainActivity.cs class of droid project, as shown in the screenshot below. After adding the package, some code initialization is required in Android project.It will take a few minutes for installing the package. To add this package, right click on your project, go to Manage NuGet Packages, search and install package from there. To use Google Maps in your project, add package from NuGet Package Manager. Here, I presume that you have created a Xamarin.Forms (Portable class library) project before proceeding. There are the following steps involved in using Google Maps in Xamarin.Andorid. In this article, I ‘ll be discussing how you can use Google Maps in your Android application. This means that shared code to use map control will be written in PCL project whereas a call to use Maps API will be native with each platform. You can use the Maps feature in Android, Windows phone and iPhone, as Xamarin is cross platform development IDE but native API implementation is required for these three target platforms. Like any other Android application built in java, Xamarin also provides you the flexibility of using Google Maps in your Xamarin.Android app. Using Google Maps in C# Xamarin.Android Application
0 Comments
Leave a Reply. |