My account status for here map is freemium but i have generated APP_CODE and APP_ID successfully but getting Incorrect application credentials when loading app please help.
For mobile maps you need app id, code and license key. Please follow instructions in https://github.com/heremaps/here-android-sdk-examples/blob/master/README.md to launch your app. Check if you have provided the below details in AndroidManifest.xml file. Also check if the package name provided both while generating credentials and your project matches exactly.
<meta-data android:name="com.here.android.maps.appid" android:value="{YOUR_APP_ID}"/>
<meta-data android:name="com.here.android.maps.apptoken" android:value="{YOUR_APP_CODE}"/>
<meta-data android:name="com.here.android.maps.license.key" android:value="{YOUR_LICENSE_KEY}"/>
Related
I have some doubts about this message in the logcat :
E/HMSSDK_AGCUtils: Get appId with AGConnectServicesConfig failed
If this error or message could give problems in the future since it is displayed when viewing the Maps Kit Map?
I have already tried the following:
No apply plugin of agconnect in build.grade
Manually add
<meta-data
android:name="com.huawei.hms.client.appid"
<!-- Replace xxx with the actual app ID, which can be obtained on the App information page. --> -->
android:value="appid=xxx">
</meta-data>
<!-- Replace xxx with the actual payment ID, which can be obtained from the app's IAP information. --> -->
<meta-data
android:name="com.huawei.hms.client.cpid"
android:value="cpid=xxx">
</meta-data>
But the message keeps popping up, is there anything else to consider? Would this message affect in some future?
Thank for for providing the information regarding this issue.
This E/HMSSDK_AGCUtils: Get appId with AGConnectServicesConfig failed message is printed when the HMS framework cannot get the AppID from AppGallery, if your App hasn't been uploaded onto the AppGallery, it is normal to show this message.
The framework will then get the AppID from agconnect-services.json file or manifest.xml, and the information is used by framework itself, will not influence the usage of Map Kit.
I am using Here maps Premium SDK 3.15 and in the documentation, it says to set id, token, and license in the android manifest file. I set id, token, and license in build.gradle as a manifest placeholder and put in Android.manifest like below.
<!-- Here Maps -->
<meta-data android:name="com.here.android.maps.appid"
android:value="${here_map_app_id}"/>
<meta-data android:name="com.here.android.maps.apptoken"
android:value="${here_map_app_code}"/>
<meta-data android:name="com.here.android.maps.license.key"
android:value="${here_map_licence_key}"/>
My project run into static code analysis and one of the finding is "Hard-Coded Secret Tokens Present in Application Code". It means I keep the here map credentials in build.gradle and it's not ok.
My question is where should I keep these credentials and is there a way setup Here maps SDK programmatically instead of Android. manifest (In case, I do not keep in the project and retrieve from Backend)
No you cannot programmatically alter the manifest file or resources except by gradle injection. According to Here maps : https://developer.here.com/documentation/android-premium/3.15/dev_guide/topics/credentials.html there is only one way to set the credentials ,however you can take some security measures see https://stackoverflow.com/a/46475968/8461344
You can use manifest placeholders:
https://developer.android.com/studio/build/manifest-build-variables
and then place your keys in env or local.properties like below
(build.gradle)
manifestPlaceholders = [
HERE_SDK_APP_ID : System.getenv("HERE_SDK_APP_ID") ?: "APP_ID",
HERE_SDK_APP_TOKEN : System.getenv("HERE_SDK_APP_TOKEN") ?: "APP_TOKEN",
HERE_SDK_LICENSE_KEY: System.getenv("HERE_SDK_LICENSE_KEY") ?: "APP_LICENSE",
]
and in AndroidManifest.xml:
<meta-data
android:name="com.here.android.maps.appid"
android:value="${HERE_SDK_APP_ID}" />
<meta-data
android:name="com.here.android.maps.apptoken"
android:value="${HERE_SDK_APP_TOKEN}" />
<meta-data
android:name="com.here.android.maps.license.key"
android:value="${HERE_SDK_LICENSE_KEY}" />
I think this has been already answered here Dynamic API KEY for Google Maps on Android
It is clear that google maps don't support dynamic API key insertion.
For any other dynamic API Keys, Where you don't want to hardcode in the project, you can check out Firebase RemoteConfig.
Here is the link,
https://firebase.google.com/docs/remote-config/use-config-android
Using Unity and CloudOnce,
I am implemeting cloudonce in my app withouth successfull, so I started a new project , just added the cloudonce and set up it correctly,
but it crashed, After look up in the logs on logcats the error was
"Using Google Play games services requires a metadata tag with the
name "com.google.android.gms.games.APP_ID" in the application tag of
the manifest for com.xxx.xxx"
after further look in the manifest, I miss this
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
After look in the Plugins/Android/AndroidManifest there is no meta data with the app id either
You can either run the Android setup from the Unity Menu or invoke it statically with the correct values. If you just want to add the app id property to the AndroidManifest.xml, you can escape it with a space to force the parser to interpret the app id as a string. This is what the plugin does when you run setup.
For example:
<!-- The space in these forces it to be interpreted as a string vs. int -->
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="\ 1213456789" />
I have setup Facebook sharing with the below, build type specific content provider:
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProviderXXX${applicationId} ...
applicationId is different per build type, so that I am able to run debug and live builds side by side on one device.
This setup gives me an error on Facebook (image file) sharing:
IllegalStateException: A ContentProvider for this app was not set up in the AndroidManifest.xml, please add com.facebook.app.FacebookContentProviderXXX as a provider to your AndroidManifest.xml file. See https://developers.facebook.com/docs/sharing/android for more info.
How can I overcome this problem? How can I get Facebook to take into account my applicationId?
You Manifest code look like below for facebook login and sharing:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/{facebook_app_id}" />
<!-- To use Facebook Login or Share, also add the FacebookActivity to the manifest:-->
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<!-- If you're sharing links, images or video via the Facebook for Android app, you also need to declare
the FacebookContentProvider in the manifest. -->
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider${facebook_app_id}"
android:exported="true" />
NOTE:
Your app is currently live and available to the public.
Follow below step to make your facebook app live and public:
1) Goto https://developers.facebook.com/
2) Select your app and goto App Review tab.
3) Check YES for Your app is currently live and available to the public. option.
See I am new How do I make my app live on FB
Your “applicationId” probably is "com.myname.blabla", and XXX your facebook app id?
I think you should switch to using 2 facebook APP_ID's, and not "applicationId". Put the facebook APP_ID's in your build types and reference them in your manifest. You then don't need to add the "applicationId" from your app.
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider${FACEBOOK_APP_ID}"
android:exported="true" />
Try with this:
If your APP_ID is 95xxx3xx60xx73xx, then it should be like:
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider95xxx3xx60xx73xx"
android:exported="true" />
For more information, you can follow this link.
In my Android app, I am integrating the Facebook SDK to have the shareDialog in it. The share dialog open perfectly with the pre-populated details. When I clicked SHARE on top right of sharedialog screen, I am getting the below mentioned error in logcat and in Toast. Please let me know where my config needs correction.
Logcat
04-17 15:15:47.140: E/Facebook(14515): Error: com.facebook.FacebookException: Failed to
authenticate the application because of app name mismatch. Please check the application
name configured by the dialog.
Go to Facebook developers page
Apps --> "YourApp" --> settings -->
Then change Package name (your application package name) and Class name (your activity class name)
for an example:
This error is occuring due to mismatch of name, may be package name or class name or even application ID.
You need to check the AndroidMainfest.xml and also the dashboard of https://developers.facebook.com/apps/yourAppID/settings/. On the xml check if this is same as on the dashboard
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="app_id" /> //the app_id must be same as on the dashboard
<activity android:name="com.facebook.LoginActivity" >
</activity>
Also check for the package name, class name of the dashboard is same on your android app.