unity admob + firebase remote config issue : admob mediation error - firebase

I have implemented admob and firebase (analytics, messaging, firestore) in unity all are working well. Later I added a remote config of firebase and even it's working well. But now when I request any ads like banner, rewarded, it's throws error :
E/Unity: AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.mediation.admob.AdMobExtras
I have removed remote config sdk from unity but still is throws error. I would be thankful if anyone can help me out.
VERSION USED
Unity 2021.2.13f1 | Admob v7.0.0 | Firebase 8.10.0
ERROR PHOTO

I Solved this by changing this line into GoogleMobileAdsDependencies.xml
<androidPackage spec="com.google.android.gms:play-services-ads:20.6.0">
to this line
<androidPackage spec="com.google.android.gms:play-services-ads:[20.6.0]">

Related

Flutter app crashing without exception when calling FacebookAuth.instance.login()

I've followed the tutorial for implementing the Facebook Login from
https://firebase.flutter.dev/docs/auth/social/
Which is the official documentation, my function is literally just:
facebookLogin() async
{
final LoginResult loginResult = await FacebookAuth.instance.login(); // final OAuthCredential facebookAuthCredential = FacebookAuthProvider.credential(loginResult.accessToken!.token);
// var credentials = await FirebaseAuth.instance.signInWithCredential(facebookAuthCredential);
}
I've commented the following function to isolate the problem.
On the console i get the following:
Performing hot reload...
Reloaded 1 of 1031 libraries in 908ms.
Lost connection to device.
And no exceptions nor errors.
Has anyone faced the same problem before?
I'm using:
flutter_facebook_auth: ^4.1.1
firebase_core: ^1.13.1
firebase_auth: ^3.3.9
In my pubspec.yaml
Is there any way to debug this problem further and find the problem?
Please ensure that you followed the setup steps one by one, and they are:
Ensure the "Facebook" sign-in provider is enabled on the Firebase Console. with the Facebook App ID and Secret set
follow the steps in the plugin (flutter_facebook_auth) documentation to ensure that both the Android & iOS Facebook SDKs have been initialized correctly
Please note that firebase flutterfire uses: flutter_facebook_auth: '^3.5.0' in their documentation and the latest version of that package 4.1.1 untill this day (3/4/2022)
It can be an issue with info.plist configuration for flutter deep-linking.
Did you setup it for your app?
https://docs.flutter.dev/development/ui/navigation/deep-linking
to be more specific you should have only one CFBundleURLTypes section in your info.plist
I had exactly the same problem. Here is how I solved.
In Info.plist, I had 2 sessions called "CFBundleURLTypes", one for Facebook Login, and another one for Google login. Apparently you can only have one CFBundleURLTypes session.
So the solution was to merge everything into a single CFBundleURLTypes session.

Expo Push Notification Unable to retrieve the FCM server key for the recipient’s app. Make sure you have provided a server key as directed…

SDK Version: 40
Platforms(Android/iOS/web/all): Android
I already have setted the expo push:android:show
error return me:
Click to see error img
If I click on button just have no returns
I’m just using the example code available on Push Notifications Overview - Expo Documentation 1
setted expo push:android:show and
fcm,firebase,push,google-services.json
look:
Cick to see what I setted
I installed the expo dependecies before expo ejected.
I setted the Firebase app name com.myname.testpush as the AndroidManifest package name as well.
“dependencies”: {
“expo”: “~40.0.0”,
“expo-status-bar”: “~1.0.3”,
“react”: “16.13.1”,
“react-dom”: “16.13.1”,
“react-native”: “~0.63.4”,
“react-native-web”: “~0.13.12”,
“expo-notifications”: “~0.8.2”,
“expo-permissions”: “~10.0.0”,
“expo-splash-screen”: “~0.8.1”,
“expo-task-manager”: “~8.5.0”,
“expo-updates”: “~0.4.0”,
“expo-constants”: “~9.3.0”,
“#react-native-firebase/app”: “^10.5.0”,
“react-native-gesture-handler”: “~1.8.0”,
“react-native-reanimated”: “~1.13.0”,
“react-native-screens”: “~2.15.0”,
“react-native-unimodules”: “~0.12.0”
},
“devDependencies”: {
“#babel/core”: “~7.9.0”,
“babel-jest”: “~25.2.6”,
“jest”: “~25.2.6”,
“react-test-renderer”: “~16.13.1”
},
posted on expo as well: https://forums.expo.io/t/push-notification-unable-to-retrieve-the-fcm-server-key-for-the-recipients-app-make-sure-you-have-provided-a-server-key-as-directed/48529
expo push:android:show (it wasn't configured for me)
then expo push:android:upload --api-key , replacing with the string you just copied. (to get the token look at https://docs.expo.io/push-notifications/using-fcm/#uploading-server-credentials)
Adding on here: I was totally confused by firebase's new cloud messaging api and the documentation.
You have to use firebase legacy cloud messaging to get a Server Key. Other than that - documentation and uploading that server key worked great as described by others.
Screenshot showing:
Solved on Expo Forum (https://forums.expo.io/t/push-notification-unable-to-retrieve-the-fcm-server-key-for-the-recipients-app-make-sure-you-have-provided-a-server-key-as-directed/48529/2)
#adamjnav creating a new project I could see that I forgot of set my experienceId: "#myexpouser/myproject"
and my app.json android: { …, “useNextNotificationsApi”: true, “adaptiveIcon”:"… }

Firebase Error: Auth error from APNS or Web Push Service

After running the following line in node-js:
import * as admin from "firebase-admin";
import * as serviceAccount from "../../firebase_service_account_key.json";
const app = admin.initializeApp({
credential: admin.credential.cert(serviceAccount as any),
databaseURL: "https://my-app-path.firebaseio.com"
});
admin.messaging().send({
token: "known-good-token",
notification: {
title: "Test Push Note",
body: "Here is some text"
}
});
I'm getting the error:
Error: Auth error from APNS or Web Push Service
Raw server response:
"{
"error":{
"code":401,
"message":"Auth error from APNS or Web Push Service",
"status":"UNAUTHENTICATED",
"details"[
{
"#type":"type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode":"THIRD_PARTY_AUTH_ERROR"
},
{
"#type":"type.googleapis.com/google.firebase.fcm.v1.ApnsError",
"statusCode":403,
"reason":"InvalidProviderToken"
}
]
}
}"
I've added an "APNs Authentication Key" to my ios project under the Settings > Cloud Messaging section of Firebase. I've also properly downloaded and imported my service account json file.
In terms of research, I've tried looking up the errors.
For the InvalidProviderToken error, this answer seems to indicate I'm using an old token. This is totally possible, but the logs on my app and database appear to match, so it seems off.
As for the THIRD_PARTY_AUTH_ERROR, google gave me no hits. The closest thing I found was this, and the following text might be the culprit (EDIT: it's not the issue):
auth/unauthorized-domain
Thrown if the app domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.
Does anyone have anymore details on this error which might help me get to the bottom of it?
This error arises if your app setup for iOS has an error in any one of the following:
Found in Settings > General > Your Apps > iOS Apps:
App Store ID
Bundle ID
Team ID
When adding an APNs key (Uploading to Cloud Messaging > APNs Authentication Key):
Team ID (should auto set based off ios app info above)
Key Id (often is in the name of the key, best to grab when creating it)
Everything worked for me the other day, so all setup was fine. But today I got this error.
Here's what solved it for me:
Revoked APNs Key
Created new one and downloaded it
Deleted old one and Uploaded it to Firebase Dashboard / Settings /
Cloud Messaging
Gone to Settings / Service Accounts and generated new private key
Added it to my Cloud Functions project (renamed it to
service-account.json in my case)
Saved the files and deployed the functions: firebase deploy --only
functions
Did you call admin.initializeApp()?
There are many official samples.
See:
https://github.com/firebase/functions-samples/blob/master/fcm-notifications/functions/index.js#L20
https://github.com/firebase/functions-samples/tree/master/fcm-notifications
https://github.com/firebase/functions-samples
https://github.com/firebase/quickstart-js/tree/master/messaging
I had the same issue. The culprit was lowercase APNs teamId. Changing it to capital solved it.
Double check if you have uploaded your apns key on firebase console. That was my case.

Invalid token because of wrong audience?

I just made a firebase project, installed the pods and got the googleplist in, configured it in the app delegate, and set it up exactly like I have other projects.
For my pods, I've got exactly what I have in my main other project :
pod 'Firebase/Core’
pod ‘Firebase/Auth’
pod ‘Firebase/Database’
When I run this code :
let ref = FIRDatabase.database().reference()
ref.setValue("hello")
I get an error that pops up like 50 times that says :
MyProjectName[209384092:9028304928034randomnumbers] [FirebaseDatabase] Autentication failed: Invalid_token (audience was project 'a random project from my firebase console' but should have been project 'myProjectName'.
I thought maybe I had done something really goofy at first, so I deleted my project entirely and reinstalled a new google.plist and redid everything, but the only thing that has changed is now I'm just getting a different random project from my firebase project list.
What's goin' on here?
I had the same error as you got, but it only occurred in simulator.
To fix this issue I had to reset my simulators content and settings.
If anyone is experiencing this issue on an actual iPhone device rather than the simulator the root cause of this issue is provided in another SO thread:
Swift/Firebase Database invalid token error
It looks Firebase plan to address it in a future SDK update but to resolve it for now you must sign-out + invalidate your Firebase Database session in your 'old' project first:
NSError *error;
[[FIRAuth auth] signOut:&error];
if (error) {
ELog(#"Firebase Logout failed: %#", error.localizedDescription);
}
Your 'new' project should then now function as expected.
Maybe you are not taking the correct apiKey and authDomain. Go to Firebase, select the project go to Authentication and then Web Setup and see if the apiKey and authDomain are the same keys that you are using in the firebase.initializeApp({});

FIRAuthInternalErrorDomain when trying to login with Google

I've setup Google login in my Firebase app (I'm using the new Firebase console), but each time I try with Google, I get the following error:
#<NSError:0x11f0625a0, description="An internal error has occurred, print and inspect the error details for more information.", code=17999, domain="FIRAuthErrorDomain", userInfo={"NSUnderlyingError"=>#<NSError:0x122278130, description="The operation couldn’t be completed. (FIRAuthInternalErrorDomain error 3.)", code=3, domain="FIRAuthInternalErrorDomain", userInfo={"FIRAuthErrorUserInfoDeserializedResponseKey"=>{"message"=>"", "errors"=>[{"reason"=>"invalid", "message"=>"", "domain"=>"global"}], "code"=>400}}>, "error_name"=>"ERROR_INTERNAL_ERROR", "NSLocalizedDescription"=>"An internal error has occurred, print and inspect the error details for more information."}>
I don't really know where yo go from here, since there's no message in the message field. Any guesses on what this could be?
I've recently migrated to the new version of Firebase btw. I'm using the new SDK in my iOS app. Furthermore, I setup Google authentication a week before I migrated. I'm not sure if any keys have been overwritten in the migration. How do I check if I have the right keys in my console vs my GoogleService plist file?

Resources