google-analytics-plugin
google-analytics-plugin copied to clipboard
Android 12 error Targeting S+
Plugin don't work with android 12. 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.
any contribution is welcome
if I set target=30 in config.xml :
<preference name="android-targetSdkVersion" value="30" />
will it work on my Android 13 device?
@DalterioRaffaele new version tested and works. what is the plugin version you are using?
<plugin name="cordova-plugin-google-analytics" spec="^1.9.0">
<variable name="GMS_VERSION" value="16.0.8" />
</plugin>
@DalterioRaffaele so please upgrade to 1.9.2 (remove the plugin and add it again). that should solve your problem.
@EYALIN Remove plugin and install 1.9.2 doesn't work (also tried to reset the project)
@peggyyu526 for some reason, upgrading the plugin does not update the whole files (it's happened to me only with this plugin). can you please share plugin.xml from the plugin? so I will try to understand what is missing there
I'm using 1.9.2 and I'm still getting an error response from startTrackerWithId
:
com.my.app: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
I'm on Android 13 - is it possible this fix didn't take or there's a regression from Android 12?
Something that work in my specific case was to change the version of the com.google.android.gms:play-services-analytics dependency, I had setted 15.0.1, and this was causing the issue. After I update to
implementation "com.google.android.gms:play-services-analytics:18.0.1"
the issue was solved. In ionic for do this you should change the version of the google play services version on the config.xml
<plugin name="cordova-plugin-google-analytics" spec="1.8.6">
<variable name="PLAY_SERVICES_VERSION" value="18.0.1" />
<variable name="GMS_VERSION" value="18.0.1" />
</plugin>
or removing and adding the plugin again adding the parameters with the proper versions for PLAY_SERVICES_VERSION and GMS_VERSION.
Also becareful, make sure if you do this change that you change all play services to the same version (18.+ in my case), for example I use cordova-plugin-googleplus, so you should change also the PLAY_SERVICES_VERSION for this plugin and all that inject a play-services dependency in the build.gradle file after the build.
any PR patch is welcome
any PR patch is welcome
As I told, there is NO need of a PR with a patch. Simply is a matter of use the properties at the time of install this plugin. As you put in the documentation:
cordova plugin add cordova-plugin-google-analytics --variable GMS_VERSION=11.0.1 --PLAY_SERVICES_VERSION=11.0.1
instead of 11.0.1, 18.0.1
yes, you are right