Ionic Capacitor : Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE - ionic-framework

I’m having this issue because of the minimum target SDK 31 update for the Play Store
I’ve had the App working well, I changed the TargetSDK in the gradle variables file and I’m getting this error :
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
Here’s the List of My Plugins :
(npx cap ls)
#capacitor-community/admob#3.2.0
#capacitor/app#1.1.1
#capacitor/haptics#1.1.4
#capacitor/keyboard#1.2.2
#capacitor/push-notifications#1.0.9
#capacitor/splash-screen#1.2.2
#capacitor/status-bar#1.0.8
#codetrix-studio/capacitor-google-auth#3.1.4
[info] Listing plugins for web is not possible.
I’ve read That I need to upgrade some plugins but i don’t know which ones
Can you please help me

To properly support SDK 31/32 you have to upgrade to capacitor 4.
Run npm i #capacitor/cli#latest. And then run npx cap migrate. That will update all capacitor dependencies and plugins to version 4 and make required changes to your native projects.

Related

Android API 31 level causes error for Flutter local notifications in the app

As per Google's policy, I updated my targetSdkVersion and compileSdkVersion to 31. But I noticed that the Flutter local notification package now throws error for incoming messages as below:
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
I went through all the Stack overflow answers related to this error and made following changes:
Added below Java and Kotlin dependencies in build.gradle file:build.gradle file
Added this receiver below activity tag:
Receiver tag
Added exported flag under activity tag:
Exported flag
Updated gradle version to latest in gradle-wrapper.properties:
Latest gradle version
I am not using any PendingIntent in my code, and simulating app on simulator with API 31 level. Could someone please help me in resolving this issue with message notifications?

Ionic - Angular with Capacitor on Android : All app updates must use Billing Library version 4 or newer. in-app-purchase-2

Version used: "#awesome-cordova-plugins/in-app-purchase-2": "^5.46.0",
Actions on Webstorm (ionic project) :
ionic build
npx cap sync
npx cap open android
Actions on Android Studio:
Generate a signed bundle
Actions on google play console:
Create new release with the signed bundle
Warning on google play :
We've detected that this app is using an old version of Google Play Billing. By November 1, 2022, all app updates must use Billing Library version 4 or newer. Update to Billing Library 4 before this date.
What I tried without success:
Add these two lines in the build.graddle:app and in capacitor.build.graddle and in the capacitor-cordova-android-plugins/build.graddle:
dependencies {
....
implementation "com.android.billingclient:billing:5.0.0"
}
What I want:
How do I update the PlayBillingLibrary from ionic and have it be taken into account with Capacitor when i sync my app on android (npx cap sync) ?
Thanks in advance
You need to update cordova-plugin-purchase to version 11.0.0 or higher (see RELEASE_NOTES.md).

Upgrading projects Flutter SDK, migration to null-safety - compile time errors in packages

We have decided to upgrade the Flutter version from 1.22 to 2.0 (migrating to null-safety) in an existing project.
We checkout Flutter v2.0.0 and then run the following command:
dart pub upgrade --null-safety
Flutter nicely resolves all dependency conflicts and sets new versions for packages.
Without changing min environment SDK in pubspec.yaml (staying at ">2.10.0 <3.0.0") we fix all breaking changes in the code.
All errors in vs code disappear so we can compile the code. But, when we do compile we get errors from packages e.g. reorderables, fl_chart, flutter_svg etc. stating some classes are undefined. It seems like packages were compiled with a higher SDK version and they weren't set min SDK version to match the one that they were compiled with.
So the package states it can be compiled with Flutter 2.10.0 but in reality, it fails to compile because in this version of Flutter it is missing some necessary imports.
My question is, is this a problem of packages or a problem in my way of processing with migration?
Is it that packages are lacking properly set min SDK?
My conclusion is that most packages are lacking correctly set SDK version constraints. It seems authors usually compile packages for a certain version and do not check min SDK version required. When running dependency resolver it seems to solve dependencies but in compile time it fails.

Is Ionic framework's compatible with tsconfig target ES2020

I am using mono repo with npm workspaces. Repo has 3 packages
server - server code
commons - common code shared between server and ionic-app
ionic-app - ionic app
Both server and commons app are configured with target of ‘ES2020’ as follows.
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
}
}
But ionic react app which uses commons package has target of ‘es5’. To match with commons tsconfig, if I change target of ionic app to “ES2020” and module to ‘commonjs’, will there be any compatibility issue while running app in mobile platform (especially older mobile)?
I did tried to use the es2020 instead of es5 and couldn't find any error.
Also, when running ng update to the angular v14, it will change it automatically to this version.
So for me it's safe to be use.
Compatibility issue
Ionic is meant to be used by older smartphone, the newest ECMAScript version (the 2020) does contains some logics that does not work on every devices (specific the older one).
Please, have a look here: https://kangax.github.io/compat-table/es2016plus/ and scroll down to the 2020 features.

Where is the version specified in Ionic app?

I'm using AppVersion.getVersionNumber() to get the version number of my Ionic app. But where does this number come from?
The problem is that when I run the app on a smartphone through devapp, I get a different version number depending on what OS I have…
iOS (on an iPhone 6): 1.0.2
Android (on a Samsung S10): 1.0.4
Searching around for "version" in my source code, I find this in config.xml (in the root):
<widget version="1.0.3" … >
I don't know if this is relevant, but it is the currently delivered version of the app.
I'm using Ionic 4.10.0
AppVersion cordova plugin reads the app details from the native code of the application.
So the version values that you see, are configured in the native IDE's.
Check these files in your respective platform folders..
ios/App/App.xcodeproj/project.pbxproj the key to look for in this MARKETING_VERSION
android/app/build.gradle the key to look for in this versionName