I used google map v2 in my android application, i created my api key in the google console.
But always i have this result in the emulator :
someone help me please ?
First make sure you have internet access with your simulator.
Then make sure you have the following in your manifest:
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR_API_KEY"/>
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/>
<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"/>
And opengl2:
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
DOC HERE
If this is still not ok, then try to use GENYMOTION emulator (with google apps).
Hope this will help you.
Related
Im having this problem since hours , i just did everything right, in the dev console i put the sha1 correctly , the package name and everything is enabled
now im getting this in my phone
but in my emualtor is working...
i thested it in 2 devices, all google play is updated, all permisions are granted in the android manifest
<permission
android:name="com.example.usuario.googlemapstest.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.usuario.googlemapstest.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Reference in android manifest
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
in the values folder is my key
i really dont know why this happends... any idea?
Release build of an app is perfectly working on Android 4.0.3 and 4.4.2 which api levels are 15 and 19. But when I try to run it on android 5.0.1 and above it shows a grey screen only even without an appbar. I am using Google Maps, Microsoft Azure simple app and support library.
My manifest uses-permissions
<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="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
And my manifest's uses-features
<uses-feature android:name="android.hardware.location" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-feature android:name="android.hardware.screen.portrait" />
To add Google Maps to your android application, you need to include a few permissions:
<!-- Required -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- Optional -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
However, by checking Google Maps Android API v2 documentation again, I noticed that
com.google.android.providers.gsf.permission.READ_GSERVICES
is no longer required. I tested it by removing it from AndroidManifest.xml and the map is loading fine without any problems.
So, my question is.. what is/was the purpose of READ_GSERVICES permission?
Note: Even though it is removed from Google Maps Android API v2 documentation, it can be found on
Google Maps API for Business documentation.
All permissions you need for Google Maps Android API are in the docs:
You must also request the android.permission.WRITE_EXTERNAL_STORAGE permission.
Note: If you're targeting the Android M SDK (23) and the latest version of the Google Play services SDK (8.1), you no longer need the WRITE_EXTERNAL_STORAGE.
From the next release of the Google Play services SDK, the requirement for the WRITE_EXTERNAL_STORAGE permission will be completely dropped from the Google Maps Android API.
So the answer is NO, you don't need it if you use current latest GPS, i.e. 8.1.0.
NO, This persimmons is no longer required in google MAP API V2
<permission
android:name="phonelocation.example.asuss550c.phonelocation.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
You only need to add
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Also this MetaData in your Application Tag
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
I have published an app on Google Play Store but when I try to download it on Tablet, it says, app is not compatible.
Also, in developer console, I get this message: Your layout should make use of the available space on 7-inch tablets
Now, 1st thing , I want to lock app to only portrait orientation and hence screen usage will be almost same.
Here's the link of the app.
Some imp info about the app:
android:minSdkVersion="10"
android:largeScreens="true" AND android:xlargeScreens="true"
To support Tablets, android docs says, check if minSdkVersion is declared with value 11 or higher. , but what if I want to support devices with OS 2.3.3 ?
Please give appropriate advice.
Edit
Is this ok?
<uses-permission android:name="android.permission.CAMERA" android:required="false"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS" android:required="false"/>
<uses-permission android:name="android.permission.READ_CONTACTS" android:required="false"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Edit 2
After updating permissions part of manifest file as following, app is showing up in tabs also:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.screen.portrait" android:required="false" />
it says, app is not compatible.
It is showing error on device not only because minSDKversion but also google play concern about your given permission on the manifest file as well.
Like if you entered something like:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Your tab will not support it.
So instead of using uses-permission use <uses-feature>. And in java file check for it that your needed hardware is available or not.
For <uses-feature> see the below link:
http://developer.android.com/guide/topics/manifest/uses-feature-element.html#features-reference
Edited:
<uses-permission android:name="android.permission.CAMERA" android:required="false"/>
<uses-permission android:name="android.permission.SEND_SMS" android:required="false"/>
<uses-permission android:name="android.permission.READ_CONTACTS" android:required="false"/>
Nope you can't give permission like this because uses-permission not allowed android:required="false". Although It will not through any error it will not work.
If you will use <uses-feature> it will take the permission to access the specific hardware.
So use this:
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
And not to forget to check this feature availability in your java code. If you will not check it, CAMERA, SEND_SMS wont work in your app.
To check camera availability use this:
import android.content.pm.PackageManager;
PackageManager pm = context.getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
// Do you camera work here.
}
I'm currently working on getting an old Titanium SDK 1.x app working in the modern era on Titanium SDK 3.1.2.
One of the challenges I've managed to find myself stuck on is after upgrading from Google Android Maps API v1 to v2 I'm consistently getting this error:
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
I have installed in the ADK the 18.0.1 build tools as well as the required Google Play Services extras package. Uninstalling/reinstalling does nothing useful, and as far as I can tell there's no way to manually include the Play Store Services library in Titanium.
For reference I followed the instructions here to set up the Maps API v2 in the app. The following is what is in my tiapp.xml file (I replaced the actual package names):
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
<permission android:name="com.example.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<application>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="###"/>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
</application>
Note that the correct certificates and correct API have been used within the Google API Console.
Does anyone have any idea why I might be unable to load the Google Play Services in my Titanium app?
Thanks in advance!
The maps only work on device. Are you running this in the emulator?
I have an additional permission set "android.permission.ACCESS_NETWORK_STATE"
Also double check to ensure your appId is correct and matches what is in your tiapp.xml file
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<!-- uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14" -->
<!-- Camera Access -->
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<!-- Allows the API to download data from Google Map servers -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- 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.wiley.TIgram.permission.MAPS_RECEIVE"/>
<permission android:name="com.wiley.TIgram.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<application android:hardwareAccelerated="true" android:theme="#android:style/Theme.Holo.Light">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="XXXXXXXXXXXXXXXXXXXXXXXX"/>
<activity android:configChanges="keyboardHidden|orientation" android:name="ti.modules.titanium.media.TiCameraActivity" android:screenOrientation="landscape" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
</application>
</manifest>
</android>
This is more of a suggestion than an answer but I got the same error and it made me bark up the wrong tree for quite some time before I realized I had an error somewhere else in the code. In my case, there was a view element that had a null attribute, though that wasn't clear from the stack trace. The Play Services error you pasted above was visible early on but it seems that the compiler will ignore it if the service is found.
:(
To make matters more confusing, I built the same code for iOS and there was no error.