Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin.Google.Android.Vending.Expansion.Downloader: PendingIntent Flags on Android 31 #1419

Open
davideravasi opened this issue Dec 8, 2022 · 1 comment

Comments

@davideravasi
Copy link

Hello everyone,
I have an issue with the library Xamarin.Google.Android.Vending.Expansion.Downloader (last version: 2.1.0) if I target android 31 in my manifest.

The issue I got from the device logs is the following one:

Error (5111) / AndroidRuntime: FATAL EXCEPTION: IntentService[LVLDownloadService]
Error (5111) / AndroidRuntime: Process: com.swisssign.swissid.mobile, PID: 5111
Error (5111) / AndroidRuntime: java.lang.IllegalArgumentException: com.swisssign.swissid.mobile: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Error (5111) / AndroidRuntime: 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.
Error (5111) / AndroidRuntime: at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
Error (5111) / AndroidRuntime: at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
Error (5111) / AndroidRuntime: at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
Error (5111) / AndroidRuntime: at com.google.android.vending.expansion.downloader.impl.DownloaderService.scheduleAlarm(DownloaderService.java:958)
Error (5111) / AndroidRuntime: at com.google.android.vending.expansion.downloader.impl.DownloaderService.onHandleIntent(DownloaderService.java:1077)
Error (5111) / AndroidRuntime: at com.google.android.vending.expansion.downloader.impl.CustomIntentService$ServiceHandler.handleMessage(CustomIntentService.java:104)
Error (5111) / AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
Error (5111) / AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
Error (5111) / AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
Error (5111) / AndroidRuntime: at android.os.HandlerThread.run(HandlerThread.java:67)
Debug (5111) / LVLDL: InnerBroadcastReceiver Called

The error happens in the following lines of code:
Screenshot 2022-12-08 at 15 36 17

When I try to download expansion files from the Play Store basically.

Now, I checked and the Pending Intent I pass in the method DownloaderService.StartDownloadServiceIfRequired has the right flag (IMMUTABLE).

Then, after more research I found this piece of code from @mattleibow (sorry for mentioning you, but I don't find any reference for this online)
Screenshot 2022-12-08 at 15 30 51

And, ta-da, in the class > https://github.com/mattleibow/Android.Play.ExpansionLibrary/blob/master/ExpansionDownloader/Service/DownloaderService.cs

Seems like the pending intent DOES NOT have the required flag.

Now I don't know if we are talking about the same class, I see that the package (Xamarin.Google.Android.Vending.Expansion.Downloader) was updated last time 2 years ago.

Any fix for this? It's pretty urgent since Play store forces android 31 as target now and our app need expansion files to work!

Thx in advance

@dellis1972
Copy link

@davideravasi if you are shipping 'assets' you might want to consider moving over to Asset Packs. Asset packs are compatible with aab files which the old expansion files are not atm.

I put a Xamarin sample together at https://github.com/infinitespace-studios/XamarinLegacyDynamicAssetsExample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants