Author- Tushar Sonu Lambole
(Android,IOS, Unity3d application developer)
Google Map For Android Native in Release Mode
1) Download and configure the Google Play services SDK. Ref Link (http://developer.android.com/google/play-services/index.html)
2) Follo the steps http://developer.android.com/google/play-services/setup.html
3) https://developers.google.com/maps/documentation/android/start
Steps
1) Download Google play service SDK
2) Import <android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib to eclipse workspace and make this project as IsLibrary.
3) Create new android project in eclipse.
4) In AndroidManifest.xml, add the following element as a child of the <application> element, by inserting it just before the closing tag </application>:
--------------
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
--------------
substituting your API key for API_KEY. This element sets the key com.google.android.maps.v2.API_KEY to the value API_KEY and makes the API key visible to any MapFragment in your application.
----------
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
-----------
5) In main.xml, add the following fragment.
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
6) In MainActivity.java, add the following code.
package com.example.mapdemo;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
7) Steps To get the API service Key
A) Go to link "https://code.google.com/apis/console/?noredirect" and activate "Google Maps Android API v2" service
B) Get the Debug keystore SHA1 key
1) Open Terminal
Run Command as it is "keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android"
2) above command will display SHA1 key
C) Click Create New Android Key....
In the resulting dialog, enter the SHA-1 fingerprint generated by the keytool,
then a semicolon, then your application's package name. For example:
BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75;com.example.android.mapexample
The Google APIs Console responds by displaying Key for Android apps
(with certificates) followed by a forty-character API key, for example:
AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0
8) Copy this key to the project manifest
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
9) Build and run project. You will see application with google map.
----------------------------------------------------
10) Steps To get the API service Key for Release Mode.
A) Sign your application same as we done for uploading on market.
B) locate your .keystore file path save... Will require path.
C) Run command in terminal "keytool -list -keystore <Path_got_in_previous_step with extension .keystore>"
D) Enter keystore password Will display MD5 Key
E) Run Command in terminal "keytool -list -v -keystore <Path_got_in_previous_step with extension .keystore> -alias <alias_name>"
F) Enter keystore password Will display MD5 and SHA1 Key
11) Follow Steps 7-C, 8 and 9 with SHA1 key got in step 10-F.
12) Finally sign your application.
13) If required do the Zipalign of APK.
A) Run command in terminal
"zipalign -v 4 <Path_of_Signed_apk_file_with_fileName_&_extension_.APK> <New_path_with_FileName_&_extension_.APK>"
14) Your APK is ready to publish on google market with release mode key.
(Android,IOS, Unity3d application developer)
Google Map For Android Native in Release Mode
1) Download and configure the Google Play services SDK. Ref Link (http://developer.android.com/google/play-services/index.html)
2) Follo the steps http://developer.android.com/google/play-services/setup.html
3) https://developers.google.com/maps/documentation/android/start
Steps
1) Download Google play service SDK
2) Import <android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib to eclipse workspace and make this project as IsLibrary.
3) Create new android project in eclipse.
4) In AndroidManifest.xml, add the following element as a child of the <application> element, by inserting it just before the closing tag </application>:
--------------
<uses-library
android:name="com.google.android.maps" />
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
--------------
substituting your API key for API_KEY. This element sets the key com.google.android.maps.v2.API_KEY to the value API_KEY and makes the API key visible to any MapFragment in your application.
----------
<permission
android:name="com.example.android.mapexample.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.example.android.mapexample.permission.MAPS_RECEIVE" />
android:glEsVersion="0x00020000"
android:required="true"/>
-----------
5) In main.xml, add the following fragment.
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
6) In MainActivity.java, add the following code.
package com.example.mapdemo;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
7) Steps To get the API service Key
A) Go to link "https://code.google.com/apis/console/?noredirect" and activate "Google Maps Android API v2" service
B) Get the Debug keystore SHA1 key
1) Open Terminal
Run Command as it is "keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android"
2) above command will display SHA1 key
C) Click Create New Android Key....
In the resulting dialog, enter the SHA-1 fingerprint generated by the keytool,
then a semicolon, then your application's package name. For example:
BB:0D:AC:74:D3:21:E1:43:67:71:9B:62:91:AF:A1:66:6E:44:5D:75;com.example.android.mapexample
The Google APIs Console responds by displaying Key for Android apps
(with certificates) followed by a forty-character API key, for example:
AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0
8) Copy this key to the project manifest
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
9) Build and run project. You will see application with google map.
----------------------------------------------------
10) Steps To get the API service Key for Release Mode.
A) Sign your application same as we done for uploading on market.
B) locate your .keystore file path save... Will require path.
C) Run command in terminal "keytool -list -keystore <Path_got_in_previous_step with extension .keystore>"
D) Enter keystore password Will display MD5 Key
E) Run Command in terminal "keytool -list -v -keystore <Path_got_in_previous_step with extension .keystore> -alias <alias_name>"
F) Enter keystore password Will display MD5 and SHA1 Key
11) Follow Steps 7-C, 8 and 9 with SHA1 key got in step 10-F.
12) Finally sign your application.
13) If required do the Zipalign of APK.
A) Run command in terminal
"zipalign -v 4 <Path_of_Signed_apk_file_with_fileName_&_extension_.APK> <New_path_with_FileName_&_extension_.APK>"
14) Your APK is ready to publish on google market with release mode key.