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

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();

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

How to do Remote Updates On Flutter

I have a flutter chat app. Companies like Whatsapp & Facebook update their app without forcing users to uninstall or manually uploading the APK again to google play. Is this possible with futter i tried using firebase remote config but it didn't work as i expected ( Changing UI on the go ). Any answer will be appreciated.
WhatsApp and Facebook use React Native with CodePush (if I'm not wrong).
You can't update an app without forcing a user somehow to update the app from a store with Flutter as it compiles to binary and React Native – not
There are multiple things you can do and it is based on what you want to achieve. [From your question your goal is not clear.]
Change Something based on configuration.
If you have configurations defined then you can use Firebase remote config to pass on value to devices and devices should behave according to value that you have set on Firebase Remote config.
Limitation of this approach:
In this approach, don't expect your newly updated code will into existing app. Above approach works, if code is already there in the compiled binary and you just want to switch path.
Binary version update:
If you want to force new app version download then it would require a different approach,
Android: Yes it is possible.
iOS: In-App update is not possible. You can show prompt to user by saying that new version is available and redirect user to new version on Store.
If user has enabled auto-download in iPhone settings then there are chances that app version updated to new version when user come to app.
For implementation look at here: Binary version update
Flutter now has unofficial support for code push using Chimera Flutter Code Push.
Here is a full tutorial

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

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.

How can I delete assets specified in pubspec.yaml in flutter?

In my flutter app, I need an asset just for the first start of the app and want to delete it afterwards. Is that possible?
I'm primarily using flutter for Android, so a platform specific answer would also be appreciated, if it's not possible to do with Dart Code.
It's impossible currently.
The rootBundle contains the resources that were packaged with the
application when it was built. To add resources to the rootBundle for
your application, add them to the assets subsection of the flutter
section of your application's pubspec.yaml manifest.
It's packaged with the app on build time, and it can't be modified.
Why don't you enable to read your assets anytime and handle the possibility of displaying in your code by condition.

How to get permission with a description?

I found on an application that asks permission to use bluetooth with a description of why this is needed. I need to implement this in my application.
How to name this function? How can this be done on ionic?
This BT request would have to be triggered via a cordova plugin, eg this one for iOS:
https://github.com/swetha-thoomoju/cordova-plugin-ios-bluetooth-permissions
..or by editing cordova's config.xml to include:
<config-file parent="NSBluetoothAlwaysUsageDescription" target="*-Info.plist">
<string>Improve location accuracy when finding nearby services</string>
</config-file>
The above is only for iOS, but I'm pretty sure something exists for Android as well.