Flutter FIrebase Admob crashing on app start even though i have added all required setups - flutter

I am trying to implement Google Admob in Flutter. I have added the required dependencies:
Android Manifest;
Added Initialization in the app
I have a google-services.json file added to my project which is the same one I have been using for Firestore etc. successfully.
But the app just does not seem to want to start. If I remove the Admob dependency from my pubspec file, the app works so this is definitely to so with the Admob.
I know that the testAppId pulls through the same appid specified in AndroidManifest as this is the google test ad id.
I have not yet implemented any banners, interstitials as yet. i am just trying to initialize first and at least get the app running.
What am I doing wrong?

So it seems the firebase_admob documentation needs to be updated as it is inaccurate.
The issue is related to the placement of the meta-data tag inside the Android Manifest.
The document indicates to place it within <application>, however it does not indicate what to do if you also have a tag for <activity> :
<manifest>
<application>
<!-- TODO: Replace with your real AdMob app ID -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-################~##########"/>
</application>
</manifest>
However, this does not work. I stumbled across the following video(https://www.youtube.com/watch?v=d2aCCIIUebc --> check the 17:20 mark) by chance and the user indicated the same problem and it is solved by moving the tag as following:
<manifest>
<application>
<activity
</activity>
<meta-data
<!-- TODO: Replace with your real AdMob app ID -->
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-################~##########"/>
</application>
</manifest>
Note: the change is to move the Meta-data tag to outside the application tag. This solves the problem and the app does not crash and loads ads as expected.

Related

Avoid deep link calls onGenerateRoute in Flutter app?

I'm trying to handle deeplinking in my Flutter app with uni_links package.
Is there a way to avoid onGenerateRoute is called by the launch deep linking? I have my own routing logic and I just need to get the deeplink string (I already do) and nothing else, I don't need to be routed anywhere.
For android,
in AndroidManifest.xml inside <activity> tag, please add
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
More info: https://docs.flutter.dev/development/ui/navigation/deep-linking#enable-deep-linking-on-android
For iOS
Inside Info.plist, add
<key>FlutterDeepLinkingEnabled</key> <true/>
More info: https://docs.flutter.dev/development/ui/navigation/deep-linking#enable-deep-linking-on-ios

Flutter - How can I follow the uninstall of the application?

I am developing a flutter app. I want to update its status in my database when the user deletes the app from own phone. How can I follow these changes? Is it possible on flutter?
There is no way to do it in iOS, but for android, you can use device_apps package to get the current list of installed apps and then compare it to the previously fetched data.
First, add this to your androids manifest file:
<manifest...>
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
</manifest>
and then use it:
List<Application> apps = await DeviceApps.getInstalledApplications();

Can't Integrate Applovin with Admob mediation in Unity

Trying to add Applovin to Admob mediation in a Unity project.The app already had Admob ads working. I imported the Applovin SDK, and was able to build it without problems. Then I imported the Google Applovin Ads Mediation package. I set the Admob key as instructed in the Android Manifest, but now it won't compile.
When I build I get this error.
"The attribute activity#com.applovin.adview.AppLovinInterstitialActivity#configChanges=orientation|screenSize|smallestScreenSize|screenLayout in :com.applovin.applovin-sdk-9.9.1: collides with another value"
Then it says:
"Attribute activity#com.applovin.adview.AppLovinInterstitialActivity#configChanges value=(orientation|screenSize|smallestScreenSize|screenLayout) from [:applovin-sdk:] AndroidManifest.xml:17:13-91 is also present at [:com.applovin.applovin-sdk-9.9.1:] AndroidManifest.xml:17:13-59 value=(orientation|screenSize).
Suggestion: add 'tools:replace="android:configChanges"' to element at AndroidManifest.xml:15:9-19:50 to override."
I am not sure where they want me to place this. Any suggestions?
Ok so after 2 days of searching I found the solution - add this to your manifest:
<activity
android:name="com.applovin.adview.AppLovinInterstitialActivity"
android:configChanges="orientation|screenSize"
tools:replace="android:configChanges"
/>
Remember to put the implementation of the SDK to pull in the latest version.

Facebook SDK Manifest Issue: Unity3d

I am using facebook package 4.3.6 for sharing post from my unitygame..
Now My sample sdk run properly with my AppID..
but as per my game requirement, i need to change in Manifest file..
This is SDK manifest file block :
<activity android:name="com.facebook.unity.FBUnityPlayerActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
Now change is that : i want to make UnityPlayerActivity as main launcher activity.. if i make it as launcher activity then fb login not working..
This change i want to make for other requirement of my game..
Please solve my this problem..
Help me guys.. Thanks to everyone for supporting me and helping me till now..
Unfortunately, you need FBUnityPlayerActivity for the Facebook stuff to work. You can extend the activity class to put in the other requirements of your game instead of extending UnityPlayerActivity.
We have new v5.0.2 beta version of the SDK which should play nice with other plugins.
Check Brian's answer in this thread How to work with Facebook SDK for Unity and Vuforia for Android?

Android Widgets separate apps?

I hate to sound like terrible newb, but are Widgets separate apps? For instance, I am creating a news reader app for Android and I want a homescreen widget. Do I create the widget as a separate project/app that hooks into the other app, or do I add the code for the widget to the original news reader app so that they are installed in tandem?
If it is a separate project/app, then how do I make sure it is installed when the "parent app" is installed, or is that sort of thing totally off base?
Thanks for any help you can offer!
P.S. Also, I have mostly been an iOS user and I'm just now getting into Android and I don't have a phone, just a tablet. So I haven't absorbed common forms and examples yet.
Just wanted to answer my own question in case anyone else comes along looking for answers. The home screen widget for an app is indeed not a separate app. All it takes to initialize a widget is to declare a BroadcastReceiver in the AndroidManifest.xml file.
Mine looks like this:
<receiver android:name=".receivers.PWReceiver" android:label="#string/widget_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="#xml/widget_config" />
</receiver>