google_maps_key was entered but still blank/didn't work - android

i use demo sample script for build google map client on android,
in ..ApiDemos\app\src\release\res\values\google_maps_api.xml
<string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">
AIzaSyA76USspcg333E7Wh11RIkNRuuXXXXXXX
</string>
i was entered make api key like in documentations procedur step by step, but is't still not working
..\ApiDemos\app\src\main\AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo">
i use the package like on Manifest
and use the package as SHA-1 signing-fingerprint
its not just for this build app..
in other myproject also dint work
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA76USspcg333E7Wh11RIkNRuuQQPSQy6Y"/>

Related

Ionic - Android authorities: FacebookContentProvider undefined in android manifest

Can’t install because provider name com.facebook.app.FacebookContentProviderundefined (in package io.ionic.sxxxx) is already used by io.ionic.yyyyy]"
This is listed in a few android manifest files
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider"
android:exported="true" />
on build I get
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProviderundefined"
android:exported="true" />
— notice the undefined ----- should I be defining something somewhere? Is there another solution? Basically I have a pair of apps that will not install at the same time on a device because this output is the same. My understanding is undefined should be my facebook id. I do have a variety of values defined in my android strings file. I have seen a few answers from a couple years ago on here (Android Facebook content provider authority) , but the solutions do not work as the files in my android directory are different as are their contents. Any help would be much appreciated!
<string name="title_activity_main">xxxx</string>
<string name="package_name">io.ionic.xxxx</string>
<string name="custom_url_scheme">io.ionic.xxxx</string>
<string name="fb_app_id">xxxxx</string>
<string name="facebook_app_id">xxxxx</string>
<string name="fb_app_name">xxxxx</string>
<string name="fb_login_protocol_scheme">fbxxxxxx</string>
<string name="fb_auto_log_app_events_enabled">true</string>
<string name="fb_advertiser_id_collection_enabled">true</string>
I have tried deleting all of the tags from all of the android manifest files, but they are generated on build. I have tried adding a string called authority in my string.xml file. I have struggeled to figure out how to implement the solutions here, as they dont exactly align with the files in my ionic project. Android Facebook content provider authority.
There is an open issue about this on GitHub:
https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues/100
Did you try the temporary solutions provided in the comments?
HCJSolutions commented on Dec 10, 2021
I found a temporary solution is add ${applicationId}
modified the platforms\android\app\src\main\AndroidManifest.xml find a
node 123456789"
android:exported="true"
android:name="com.facebook.FacebookContentProvider" />
or
change it at
plugin folder plugins\cordova-plugin-facebook-connect\plugin.xml find
the line <provider
android:authorities="com.facebook.app.FacebookContentProvider${applicationId}$APP_ID"
and
apren commented on Apr 24:
Another temporary solution:
Set any APP_ID, for example APP_ID = "app_package_name" After init app
use code
facebookConnectPlugin.setApplicationId('your_facebook_app_id')

"nativescript-google-maps-sdk" PlugIn shows blank screen

I have installed nativescript-google-maps-sdk plugin in my NativeScript 2.0 project.
I generated and activated an Android API key at the Google Developer Console.
As described in the documentation of the plugin I added the string resource value nativescript_google_maps_api_key with the API key, but it does not work.
I also tried to add the google_maps_key string resource as described in the official Google documentation, so my resource file looks like this:
<resources>
<string name="google_maps_key">MY_API_KEY</string>
<string name="nativescript_google_maps_api_key">MY_API_KEY</string>
</resources>
My last try was to add a meta value to the AndroidManifest.xml file:
<manifest>
<application>
...
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="MY_API_KEY" />
</application>
</manifest>
In my app.gradle file I added a reference to the com.google.android.gms:play-services-maps:8.3.0 package.
But nothings helps ... I still have a blank screen with a Google logo but no map.
I had same problem.
After I checked "Use Host GPU", it worked
Open Android Virtual Device (AVD) Manager
Select emulator and click Edit
Check Emulator Options: Use Host GPU
I was unable to run this plugin correctly, maybe it is not compatible with NativeScript 2.0.
However you could use official NativeScript plugin nativescript-geolocation or nativescript-googleMaps, which work normal on both iOS and Android.
You could read more about the plugin here: NativeScript Location
Also you could review this sample app with nativescript-googleMaps location
To upgrade the project to latest NS 2.0. run npm install tns-core-modules#latest --save
Indeed you should add this line
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="API_KEY" />
before </application> closing tag in AndroidManifest.xml
I have followed the exact steps as shown in the demo app and it worked correctly!
Now the first thing I have noticed is that the file with your API-Key is located as follows
App_Resources/Android/values/nativescript-google-maps-api.xml
And looks like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="nativescript_google_maps_api_key">your-api-key-here</string>
</resources>
In the map-page.xml we have
<Page xmlns="http://www.nativescript.org/tns.xsd" xmlns:maps="nativescript-google-maps-sdk" loaded="pageLoaded">
<GridLayout>
<maps:mapView latitude="{{ latitude }}" longitude="{{ longitude }}" zoom="{{ zoom }}"/>
</GridLayout>
Keep in mind that in the demo the author has passed the params via view-model but
you can always hardcore the values for latitude ,longitude and zoom for test pourposes.
And thats all that is needed in order for the plugin to work.
If you're having this problem, and everything you try does not seem to do anything, I would recommend checking your Android Logs.
adb logcat
Check for the following:
Google Maps Android API: Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
This was my problem. The emulator I was using did not support the stated version of OpenGL. So I created a new emulator, checking off Use Host GPU and that seemed to cure the blank map with logo issue.
I think the Use Host GPU is the key. The old emulator I was using didn't have this option, so I couldn't verify this.

Building apk to debug and release mode without changing Android Google API key each time?

I use gmaps in my app and the api key from a file looks like:
<resources>
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
<!-- DEBUG -->
<!-- AIzaSyB#####MY_DEBUG_API_KEY_HERE -->
<!-- RELEASE -->
AIzaSyBS####MY_RELEASE_KEY_HERE
</string>
I wouldn't like to change beetwen keys each time i build a release because i could easily forget about it and in that way gmaps wont work in released app.
I taught about using only one key but from almost every source i looked up it is marked as bad practice.
So is there an easy way/option maybe with build type/flavour to somehow made the build process "smart" to :
When i build in debug mode my build could use the debug api key and vica vera with the release build?
You can define resource files in build type specific folders.
For example, in /app/src/debug/res/values/strings.xml:
<string name="google_maps_key">debug_maps_key_here</string>
And in /app/src/release/res/values/strings.xml:
<string name="google_maps_key">release_maps_key_here</string>
The build system will automatically use only the resources for the build type it is currently building, thus using the correct key for each build.

xamarin google map not working

I created a map using the following link http://developer.xamarin.com/guides/android/platform_features/maps_and_location/maps/part_2_-_maps_api/ i followed all the procedures mentioned in it but what am getting is a blank screen. My application Output shows the following log on executing the map activity.
Open Connection [REQUEST] DRD(41): 62|147 [REQUEST] Close [REQUEST] Error processing: com.google.maps.api.android.lib6.b.d#42a1cef8 not retrying [REQUEST] Retrying: com.google.maps.api.android.lib6.c.au#429ced70
Can anyone please tell me why this is happening.
If you are unable to view the map after deploying a Release apk, follow this Video..
https://www.youtube.com/watch?v=xLJ0jDFdUZ0
As it says :
Create a KeyStore from Visual Stuido.
a. Put project config mode to Release.
b. Clean and Build your Android project.
c. Right click your Android project and select Archive (Before that specify the version code and version name in your manifest or in properties).
d. Once the archive is completed, click on Distribute.
e. Select AdHoc channel.
f. Create a new Signing Identity with Alias, Password and other info.
g. This signing key creates a KeyStore file in location :
C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore
Note : [Alias] is the name you defined when creating the KeyStore file
Open your cmd. cd to C:\Program Files\Java\jdk1.8.0_131\bin
Execute : keytool -list -v -keystore "C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore" -alias [Alias]
You will get the output with MD5, SHA1, SHA256... Copy the SHA1 key.
Go to https://console.developers.google.com . Select your project you created for Android API key.
Click on credentials and select your API key.
Add new Package name and finger print with your project's package name and SHA1 key you copied.
Note : Project's package name defined on Android Project's manifest and properties.
Wait for like 5 mins to take the changes to affect. Afterwards you can again archive and get a new APK. Install on your android device and see. You will now be able to see the map.
NOTE :: I am referring to Xamarin, Visual Studio 2017
As #Miha mentioned this is keys related.
At present you will not be getting any map tiles displayed on the map.
To get the example to work there are several things that you need to do.
1) Obtain your Signing Key Fingerprint (SHA1) for your machine.
If you haven't already created your SHA1 key for your machine you will need to do this first. The link here describes how to generate this using the command console.
You will get a SHA1 key fingerprint as a result of this.
2) Obtain the package name from the project you are working on.
This can be located by looking at the Android project properties under the Android Manifest tab. You will then see a text-box for the Package name field.
3) In Google Developer Console you will need to create an Application should you not already have one, and Create A New Android key (This is located under APIs & auth \ Credentials).
On the screen that will pop-up you will be able to enter in the SHA1 key and Package Name that you have previously captured in the format {SHA1};{Package Name}.
This will then return to you the API key that you will use in the next step:-
4) In the Android Project, look at the source for AndroidManifest.xml. You will see the following:-
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="{some api key}" />
Enter you API key in that you have previously captured.
5) In the Google Developer Console, for the project, you also have to remember that you have to enable Google Maps Android API v2 and also Google Play Android Developer API. You can find these under APIs & auth \ APIs
You should then, finally, be able to run the demo.
Update 1:-
Add the uses-permission for MAPS_RECEIVE as #leoneboaventura mentioned also, so something like the following:-
<uses-permission android:name="{your-package-name}.permission.MAPS_RECEIVE" />
I just figured out what was wrong in my case. Probably because of Java naming rules, you have to name your package with the first letter in lowercase. Visual Studio names our packages following C# naming rules, which spells the first letters capitalized.
So, check if this issue isn't the same causing your map to don't open by doing the following:
1) Make sure your package name starts with small letter.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mypackage.android" android:versionCode="1" android:versionName="1.0">
Make sure your package is named mypackage.android not MyPackage.android.
2) Make sure your package name in the following two permissions matches the manifest package name spelling:
<uses-permission android:name="mypackage.android.permission.MAPS_RECEIVE" />
<permission android:name="mypackage.android.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
3) Check if you APIKey is been generated to the same package name:
{your SHA1 certificate fingerprint}:mypackage.android
Change AndroidManifest.xml like this
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<application ...>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="yourApiKey" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
</application>
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>
</manifest>

Android - Failed to find provider info for com.google.settings in MapView Example

I'm trying to implement the MapView example which is defined in Android Hello Views example but now I'm facing this error:
Failed to find provider info for com.google.settings
Any idea why this is happening?
The MapView example doesn't set API key by default. So you must set it. Here is step by step:
Get MD5 from your system
%JAVA_HOME%\bin\keytool.exe -list -alias androiddebugkey -keystore "%userprofile%\.android\debug.keystore" -storepass android -keypass android
Get API key by pasting the generated MD5 to this page:
http://code.google.com/android/maps-api-signup.html
Paste the generated API key to {your_project_root}/res/layout/map.xml
<com.google.android.maps.MapView
android:id="#+id/myMapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="paste_generated_api_key_here"
/>
In AndroidManifest.xml, make sure that you have the folowing tag into your application tag:
<uses-library android:name="com.google.android.maps" />
and also the folowing tag into your manifest tag:
<uses-permission android:name="android.permission.INTERNET" />
Refresh your project and run
Note:
The path of keytool.exe, debug.keystore and map.xml may differ on your system.
If you publish your app, be sure to register another API key.
If you don't set API key properly, your app will fail on phone and the error message probably is "... has stopped unexpectedly. Please try again. - Force close"
More detail at http://d.android.com/guide/tutorials/views/hello-mapview.html
If you've made sure you have INTERNET permission, and have correctly generated API key, and have put it in android:apiKey, and the same error still happens, here's one more thing to check: is your application signed with the same certificate that you used for Maps API key?
Android build tools use different certificates for debug builds and for release builds. If you've generated MD5 checksum and API key for release certificate (the one that you use in "Export Android Application" wizard to generate .apk), it won't work in debug builds--and vice versa.
You can find out where your debug keystore is located in Eclipse's Preferences > Android > Build page. You can generate MD5 checksum and API key for it the same way as for your release certificate. Default password for debug keystore is "android".
Here's official docs about debug keystore
One more thing to check:
I just had this problem (or rather, my problem was that the map was not showing up). I had skimmed through the map view tutorial and pasted the "uses-permission" tag inside the application tag by mistake. It needs to be directly under the manifest tag, like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest [...]>
<uses-sdk [...] />
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="com.google.android.maps" />
[...]
</application>
</manifest>
A very simple mistake, but it took me a while to find. Hopefully this helps someone else!
Just review Hello, MapView :
Make sure you have included into AndroidManifest.xml line for permissions:
<uses-permission android:name="android.permission.INTERNET" />
Also, have you got Google Map API Key?
Put it into MapView layout definition:
<com.google.android.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="Your Maps API Key"
/>
Other mention of error:
GGroups - MapView showing as black screen after upgrade to 1.5
I have only encountered this issue on the emulator and I have found that the only way around this error is to restart the emulator.

Categories

Resources