I created my google api key for google maps v2 for android, everything is set up in eclipse for google maps (using google+api build, linking to google play services, api key sorted, etc), I can view a map app fine on my phone but when I view the same app on the AVD it's going to the right location and I can see all the google map overlays (such as zoom button) but there is no map, it is just a grey box. Networking is fine as well.
I am using the latest 4.3 API 18 build and my AVD is the default Nexus One. Prior to this I got the dreaded 'update google play services' message which I found was due to maps v2 simply not working on 4.2 so I upgraded reading that maps should work ok with SDK 18 on AVD.
Any idea why it's not showing? I did notice when I start the AVD it says using software opengl but I'd have thought it was ok.
I've read various stackoverflow articles but they all point at an incorrect configuration and mine is fine and working just dandy when I send it to my phone and it's throwing no errors.
If it's any help here are some snippets of code I'm using.
manifest:
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-library android:name="com.google.android.maps" />
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="XXXXXXXXXXXXXXXXXXXX"/>
layout snippet:
<fragment
android:id="#+id/worldmap"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
code to initialise a map:
private void initialiseMap() {
if (googleMap == null) {
googleMap = ((SupportMapFragment) getFragmentManager().findFragmentById(
R.id.worldmap)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(activity.getApplicationContext(),
"Unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
code to display the map:
private void displayLocation(Location l, String text) {
if(googleMap!=null) {
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
LatLng ll=new LatLng(l.getLatitude(), l.getLongitude());
CameraPosition cp=new CameraPosition.Builder()
.target(ll)
.zoom(18)
.build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cp));
Toast.makeText(activity, l.getLatitude()+":"+l.getLongitude(), Toast.LENGTH_LONG).show();
}
}
You should see something like
E/Google Maps Android APIļ¹ Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
in the console. This is a known problem with emulator with Google APIs. I suggest switching to Genymotion, which works and works very well.
To run Google maps successfully on AVD
Create a non Google API emulator API level is higher than 3.0
Download Google play services apk using online apk downloader in to your pc (must be the latest version)
Download Google play srore apk (must be the latest version)
Install those apks using adb install command on
Android emulator
Now everything is ready to test Google maps v2 on the emulator. Run your application on the emulator
In my experience I've seen that just getting a grey map means that there is some license key problem (so Google is refusing to server up the colorful map tiles), but otherwise everything else is probably fine with your app (especially if you can scroll around the grey map).
Related
Problem Summary
My app (in development), when run on the desktop, can both:
Write to & read from private storage
Write to & read from public storage.
However, when run on Android, only private storage is accessible.
How To Replicate The Issue
Instead of sharing excerpts of my project's codebase, let me refer to another codebase we share and have - the gluon-connect-file-provider project in Gluon Samples. The sample apps only demonstrate private storage usage. None demonstrate public storage usage, so in the gluon-connect-file-provider project, you can make the following change in com.gluonhq.samples.connect.file.Main.java:
Before
static {
ROOT_DIR = Services.get(StorageService.class)
.flatMap(StorageService:getPrivateStorage)
.orElseThrow(() -> new RuntimeException("Error retrieving private storage"));
}
After
static {
ROOT_DIR = Services.get(StorageService.class)
.flatMap(s -> s.getPublicStorage("Gluon"))
.orElseThrow(() -> new RuntimeException("Error retrieving public storage"));
ROOT_DIR.mkdir();
}
When starting the app on the Desktop after this change, you can first observe the directory ~/Gluon being created on your machine. Then, as you toggle the checkbox on/off in the app's Object Viewer screen, you can also confirm the underlying JSON file ~/Gluon/user.json is being updated. So, therefore, we can agree public storage works.
However, when deployed to Android, we can see file-permission related failures in the scrolling terminal during mvn -Pandroid gluonfx:nativerun. First, the Gluon directory fails to be created at startup and, consequently later, attempts to write the user.json file occur.
I thought the soluton was to define in the project the file src/android/AndroidManifest.xml. The default found at target/gluonfx/aarch64-android/gensrc/android/AndroidManifest.xml does not include the following permissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
So, I copied the generated AndroidManifest.xml file to src/android, including these entries to it. Even though the Android Settings shows me my app has Storage Permission, this still didn't resolve the problem.
Note - when preparing this post asking for your help, I noticed that, without also provisioning src/android/AndroidManifest.xml file with EXTERNAL READ/WRITE permissions for the gluon-connect-file-provider, the Android device already showed the deployed app had Storage Permission enabled.
I used two different Android devices to test with.
Pixel XL running Android version 10.
Samsung S9 running Android version 10.
I tested with the latest GluonHQ Attach dependency 4.0.13 and also with the oldest I found available, 4.0.7.
Is there something more that must be done for the Storage Attach Service to allow public storage access on Android? Please tell me how else to modify the gluon-connect-file-provider app to make it so, thank you.
Resolution
Update to Gluon Attach 4.0.14.
<dependency>
<groupId>com.gluonhq.attach</groupId>
<artifactId>storage</artifactId>
<version>4.0.14</version>
</dependency>
With this update, Storage Service will allow you to access pre-existing Android folders, like "Documents" for example. Or, as seen in this post's code excerpt above, you can define your own new directory like "Gluon", or naming the folder after your own App.
Extra
Another cascading result of this Attach update is, in addition to Storage Service, file sharing via the Share Service is now available on Android. Its JavaDoc states Storage Service as a requirement to use Share Service. Below is a quote from its documentation:
Note that on Android, the file has to be located in a public folder
(see StorageService#getPublicStorage), or sharing it won't be allowed.
I have a Xamarin.Android application which is registered for push notifications with Firebase. Everything works perfectly when the app is in the foreground. However, when the app is in the background and I send it a notification from the Firebase console, the icon that I've set as the default for notifications is not being used, and Android is using a greyscale version of the application's launcher instead:
And the same goes for the notification in the tray:
This shouldn't be happening, since I have the following line in my AndroidManifest:
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="#drawable/ic_notification" />
And I have monochrome icons in my drawable folders which follow the guidelines detailed by the Android documentation.
I understand the the Firebase console only sends messages without the Data payload, which is why OnMessageReceived in my FirebaseMessagingService is not called when the app is in the background. What I don't understand is why Android is using my launcher icon instead of the one specified in the manifest for notification-payload-only FCM messages.
I am using version 32.961.0 of Xamarin.Firebase.Messaging, since version 42.1001.0 (the latest stable version) has dependencies which break my app in other ways. Is this likely to be an issue with my version of the package, or is there something else I may be doing wrong?
Updating to Xamarin.Firebase.Messaging version 42.1001.0 fixes the issue; it appears to have been a limitation in Firebase Messaging SDK < 9.8.0 (32.961.0 maps to version 9.6.1).
Using Xamarin.Forms.Maps 2.3.3.193. The call to GetAddressesForPositionAsync always returns null for Android. It works fine for iOS and UWP. I've only tried on the Visual Studio emulator, but the other platforms work with the emulators/simulators. I have set a location in the emulator. Anything I'm missing?
Same situation for GetPositionsForAddressAsync.
I have the map API key entered in the AndroidManifest.xml file:
<application android:label="My.Mobile.XamarinForms.Droid">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="My API Key" />
</application>
Wanna make an app? - That's simple!
Wanna make it work on different versions? - Learn rocket science.
Have seen the following answers and more, but none helped:
Answer 1
Answer 2
Answer 3
So, here's my AndroidManifest chunk:
:
:
:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<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_PROFILE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
:
:
and the relevant chunk from build.gradle:
:
:
android{
compileSdkVersion 23
buildToolsVersion "23.0.2"
:
:
When I first installed the app on Marshmallow (6.0.1), the installer said (something very similar to) - "it requires no special access (or permissions)". The app failed to go beyond the splash screen too, whereas on other Android versions, the sailing is smooth and complete.
The answers listed above explain why, (change in the permission model etc.), from which I cannot figure out what really to do.
My requests are:
Please let me know how to make the app install exactly as it installs on lesser versions than 6.0.
How to keep code changes (if required) to the barest minimum
How not to complicate the existing, automatic permissions request at install time (with run-time permissions and all that).
Many thanks in advance!
Welcome to Marshmallow. Android M(6.0) introduced runtime permission model. You are suppose to handle requesting for permissions in runtime. You could refer to my github sample on how to do it. There are a few other libraries like easypermissions to enable developer get rid of the hassles.
For an Adobe AIR app (which is published since over a year in Apple App Store) I'm trying to submit an update using Application Loader, but get the following error:
ERROR ITMS-9000: "Invalid Code Signing. The executable
'Payload/XXX.app/XXX' must be signed with the certificate that is
contained in the provisioning profile." at
SoftwareAssets/SoftwareAsset (MZItmspSoftwareAssetPackage)
The app has been created with Flash Builder 4.7 and Apache Flex 4.11.0 and AIR 4.0:
The app compiles and runs at my test device (iPhone 5c) just fine.
Why is it rejected by the Application Loader?
It could be something minor, like a missing icon or splash image...
Of course I have tried the obvious several times and revoked/created new certifcates and created new distribution provisioning profiles for the App Store.
Below is the excerpt from my XXX-app.xml:
<autoOrients>true</autoOrients>
<fullScreen>true</fullScreen>
<visible>true</visible>
<softKeyboardBehavior>none</softKeyboardBehavior>
<icon>
<image16x16>assets/icons/icon-16x16.png</image16x16>
<image29x29>assets/icons/icon-29x29.png</image29x29>
<image32x32>assets/icons/icon-32x32.png</image32x32>
<image36x36>assets/icons/icon-36x36.png</image36x36>
<image48x48>assets/icons/icon-48x48.png</image48x48>
<image57x57>assets/icons/icon-57x57.png</image57x57>
<image72x72>assets/icons/icon-72x72.png</image72x72>
<image114x114>assets/icons/icon-114x114.png</image114x114>
<image128x128>assets/icons/icon-128x128.png</image128x128>
<image512x512>assets/icons/icon-512x512.png</image512x512>
<image50x50>assets/icons/icon-50x50.png</image50x50>
<image58x58>assets/icons/icon-58x58.png</image58x58>
<image76x76>assets/icons/icon-76x76.png</image76x76>
<image100x100>assets/icons/icon-100x100.png</image100x100>
<image120x120>assets/icons/icon-120x120.png</image120x120>
<image144x144>assets/icons/icon-144x144.png</image144x144>
<image152x152>assets/icons/icon-152x152.png</image152x152>
<image1024x1024>assets/icons/icon-1024x1024.png</image1024x1024>
</icon>
<iPhone>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>
<extensions>
<extensionID>com.adobe.Vibration</extensionID>
<extensionID>com.adobe.ane.gameCenter</extensionID>
</extensions>
</application>
The splash images included in the .ipa file are:
Default-568h#2x.png
Default-Landscape.png
Default-Landscape#2x.png
Default-Portrait.png
Default-Portrait#2x.png
Default.png
Default#2x.png
You need you use the AIR 4.0 beta (selectable form the installer AIR menu).
One of the fixed issues is:
Bug 3686074: [APPLE][XCODE5] New apps and app updates submitted to the App Store must be built with the latest version of Xcode 5 from Feb1