Use two different accounts with Fabric - android

I have an application with some separated modules.
In addition, I want to use a different fabric users (api keys) for each module.
When I try to register another module with the fabric key in the manifest, like this:
<meta-data
android:name="io.fabric.ApiKey"
android:value="My_Key" />
I get an error of duplicated apikey.
Is there any option to implement this?

Related

Android Here Maps set api keys programmatically

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

CloudOnce not merging correctly the manifest

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" />

Disable Firebase crash reporting

I have decided to include the Firebase Crash API 9.0.1 into my Android app.
At the moment everything is working fine. Now I want to give my users the opportunity to disable, that Firebase is sending the Crash reports automatically.
Firebase Analytics can be disabled with this code snippet
FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false);
Does anyone of you know a similar way to disable crash reporting?
Many thanks
Sorry for short answer but currently there is no official support for this.
EDIT: 30/10/2017
Now it is possible to enable/disable at build time adding in the AndroidManifest.xml:
<meta-data android:name="firebase_crash_collection_enabled" android:value="false" />
or runtime using:
FirebaseCrash.enableCrash(true|false);
More info here.
Yes it is possible now. Check this,
Disable Crash Reporting
Simply add the below line to your code in the first activity or even better in the Application class.
FirebaseCrash.setCrashCollectionEnabled(false);
To enable,
FirebaseCrash.setCrashCollectionEnabled(true);
This is really helpful when we have multiple build types such as Debug, Release etc.
You can find the instructions on the page:
https://firebase.google.com/support/guides/disable-analytics
Disable Analytics collection on Android
Temporarily disable collection
If you wish to temporarily disable Analytics collection, such as to get end-user consent before collecting data, you can set the value of firebase_analytics_collection_enabled to false in your app's AndroidManifest.xml in the application tag. For example:
<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
To re-enable collection, such as after an end-user provides consent, call the setAnalyticsCollectionEnabled() method of the FirebaseAnalytics class. For example:
setAnalyticsCollectionEnabled(true);
If you need to suspend collection again for any reason, you can call
setAnalyticsCollectionEnabled(false);
and collection is suspended until you re-enable it.
Permanently deactivate collection
If you need to deactivate Analytics collection permanently in a version of your app, set firebase_analytics_collection_deactivated to true in your app's AndroidManifest.xml in the application tag. For example:
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />

Android Facebook ContentProvider and multiple Build Types

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.

Hard coded string causes an error in the manifest of android

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>

Categories

Resources