Get Maps Api Key :android
Solution 1:
Locate debug.keystore on your system. It is usually in the
USER_HOME\Local Settings\Application Data\.android
folder on windows.Use the keytool utility to generate certificate fingerprint (MD5). keytool utility that comes with the default JDK installation.
C:>keytool -list -alias androiddebugkey -keystore .android\debug.keystore -storepass android -keypass android
You can get a temporary Maps API Key based on your debug certificate, but before you publish your application, you must register for a new Key based on your release certificate and update references in your MapViews accordingly
You may also have to obtain other release keys if your application accesses a service or uses a third-party library that requires you to use a key that is based on your private key. For example, if your application uses the MapView class, which is part of the Google Maps external library, you will need to register your application with the Google Maps service and obtain a Maps API key. For information about getting a Maps API key, see Obtaining a Maps API key.
Solution 2:
get your debug signature as described below
$ keytool -list -keystore ~/.android/debug.keystore
...
Certificate fingerprint (MD5): 94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98
or better use the one you get from sigs[i].hashCode()
then this util func may also help
staticfinalintDEBUG_SIGNATURE_HASH=695334320;// value shpuld be the one you get abovepublicstaticbooleanisDebugBuild(Context context) {
boolean_isDebugBuild=false;
try {
Signature [] sigs = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures;
Log.d(TAG, "DEBUG_SIGNATURE_HASH->"+DEBUG_SIGNATURE_HASH);
for (inti=0; i < sigs.length; i++) {
Log.d(TAG, i+"->"+sigs[i].hashCode());
if ( sigs[i].hashCode() == DEBUG_SIGNATURE_HASH ) {
Log.d(TAG, "This is a debug build!");
_isDebugBuild = true;
break;
}
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return _isDebugBuild;
}
Post a Comment for "Get Maps Api Key :android"