Usando Android Maps v2 - watter/titanium GitHub Wiki

Primeiro é necessário criar uma API Key de acesso ao serviço de Maps v2.

Acessando o [Google APIs Console](https://code.google.com/apis/console), entre em API Access. Se não houver um produto criado, precisamos criar um.

Package Name: App ID do app usado no Titanium Studio URL: Pode ser a URL usada no projeto do Titanium também

SHA1: No terminal, digite: keytool -list -v -keystore <Pasta de instalação do Titanium>/mobilesdk/<sistema operacional>/<versão mais recente>/android/dev_keystore

Ao ser pedido pela senha, não digite em nada e pressione enter.

leslieh@ecelepar17063:/home/leslieh/.titanium/mobilesdk/linux/3.1.1.GA/android$ keytool -list -v -keystore dev_keystore 
Enter keystore password:  

*****************  WARNING WARNING WARNING  *****************
* The integrity of the information stored in your keystore  *
* has NOT been verified!  In order to verify its integrity, *
* you must provide your keystore password.                  *
*****************  WARNING WARNING WARNING  *****************

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: tidev
Creation date: 23/05/2009
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Appcelerator Titanium, OU=Nolan's Gang, O=Appcelerator, L=Mountain View, ST=CA, C=US
Issuer: CN=Appcelerator Titanium, OU=Nolan's Gang, O=Appcelerator, L=Mountain View, ST=CA, C=US
Serial number: 4a1786e2
Valid from: Sat May 23 02:17:22 BRT 2009 until: Wed Jan 14 03:17:22 BRST 2995
Certificate fingerprints:
	 MD5:  66:5E:D1:7F:C4:2C:B9:73:AD:7F:4D:DD:29:12:56:56
	 SHA1: CC:E3:7F:08:FA:03:9C:88:07:BC:CB:AB:7B:88:61:F4:75:9D:47:9F
	 Signature algorithm name: MD5withRSA
	 Version: 1


*******************************************
*******************************************

Cole o SHA1 do certificado no campo de texto.

Em Application Type selecione Installed Application e Android.

Podemos finalizar.

Na seção Services habilite o uso de Android Maps v2 e retorne para API Access.

Debaixo do campo Key for browser apps (with referers) que apareceu, clique no botão Create New Android Key…

No campo, cole a SHA1 do certificado seguido de ; e o Package Name novamente. Exemplo: CC:E3:7F:08:FA:03:9C:88:07:BC:CB:AB:7B:88:61:F4:75:9D:47:9F;com.exemplo.meuapp

Um novo campo aparecerá na tela, chamado Key for Android apps (with certificates). Lá estará a API Key criada.

No Titanium Studio, adicione estas linhas ao <manifest>:

<manifest>
           <!-- Allows the API to download data from Google Map servers -->
           <uses-permission android:name="android.permission.INTERNET"/>
           <!-- Allows the API to cache data -->
           <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>   
           <!-- Use GPS for device location -->
           <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
           <!-- Use Wi-Fi or mobile connection for device location -->
           <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
           <!-- Allows the API to access Google web-based services -->
           <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
           <!-- Specify OpenGL ES 2.0 as a requirement -->
           <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
           <!-- Replace <com.domain.appid> with your application ID -->
           <uses-permission android:name="<com.domain.appid>.permission.MAPS_RECEIVE"/>
           <permission android:name="<com.domain.appid>.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
           <application>
               <!-- Replace "PASTE YOUR GOOGLE MAPS API KEY HERE" with the Google API key you obtained -->
               <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="PASTE YOUR GOOGLE MAPS API KEY HERE"/>
           </application>

Referências: http://docs.appcelerator.com/titanium/latest/#!/guide/Google_Maps_v2_for_Android https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key

⚠️ **GitHub.com Fallback** ⚠️