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" />
Related
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
I'm very new to Android and I want to launch my first application but I'm facing problem while I'm trying to apply AdMob code in my application.
When I check my code with test ad id it is working fine but when I'm using the same code with my real AdMob App id and Unit id this give me no add in my frame and the Logcat is showing me this.
19 5029-5216/com.example.aviralchauhan.demoplayer E/FA: GoogleService failed
to initialize, status: 10, Missing google app id value from from string
resources with name google_app_id.
2019-07-23 12:14:10.330 5029-5216/com.example.aviralchauhan.demoplayer E/FA:
Missing google_app_id. Firebase Analytics disabled 2019-07-23 12:14:10.336 5029-5216/com.example.aviralchauhan.demoplayer E/FA:
Uploading is not possible. App measurement disabled
As you suggested that this is duplicate question so can you please explain that it's really important to connect the application with firebase to show to ads in my application as I already told you test ads are working fine.
No, it is not really necessary to integrate Firebase with Google but it is recommended so as to get detailed statics over how the user acts over your app and their interaction with the app.
Now, the main topic: Why the add code is not working?
I am sure that you have something like this in your manifest.xml file:
<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="YOUR_ADMOB_APP_ID"/>
</application>
</manifest>
There, the text YOUR_ADMOB_APP_ID must be replaced by a real ID which you will get by adding your app to the AdMob dashboard. Check this to get the real ID.
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
set on app AndroidManifest.xml file
I am facing a weird behavior while generating signed apk. In my app I am integrating facebook integration and using facebook app id in string and giving reference from string resource file. Since my app is multi lingual it is giving me below error.
as mentioned in below link I am giving app id in string file
Error on application ID of facebook app in Manifest
as I am developing multi lingual app and created 2 string files and created a string with name 'facebook_app_id' in both files. I don't know the reason while I am giving the same name in both files
I have solved the problem by just adding the below lines in meta tag line.
tools:ignore="ManifestResource"
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id"
tools:ignore="ManifestResource" />
as mentioned here
https://code.google.com/p/android/issues/detail?id=194705
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.
I programmed hardcoded manifest file, like below:
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="111111111111" />
In this case, facebook sdk couldn't detect meta-data definition.
But, the way to reference string value works well.
I aware the reason of using string resource file is for performance issue. however, there seems to be another reason.
What's that?
I agree with Mr. Murphy, I tried the same but at the end i had to put the Facebook App Id inside my Strings.xml, probably security reasons, your FB App Id must be "loaded from your project".
the example described in the documentation does the same:
To update your app, first add a reference to your App ID into the
AndroidManifest.xml file. Since you are no longer using your App ID to
instantiate a Facebook object, you will need to include the following
line to allow the SDK to identify your application on Facebook:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/app_id"/>
Next, add a string resource to your strings.xml file with your App ID.
<string name="app_id">12345678910</string>