mitchhymel / local_notifications

No longer in development -Flutter plugin for creating notifications
BSD 2-Clause "Simplified" License
108 stars 14 forks source link

Bring Android minsdk down to 16 to support all versions of android Flutter supports #10

Closed mitchhymel closed 6 years ago

mitchhymel commented 6 years ago

This seems doable by swapping out the Android APIs with their corresponding Compat APIs.

The one weird thing is that Android 16 and 17 have a bug where the app requires Vibrate permission else an exception will be thrown when calling NotificationManager.notify(). See this StackOverflow post for reference.

A workaround to this could be to add the following to the AndroidManifest

<uses-permission android:name="android.permission.VIBRATE" android:maxSdkVersion="17"/>
mitchhymel commented 6 years ago

Completed with commit 12ab6443aa53bbd4fb3f31fb52c3a99e38af523d and included in version 0.0.5

aaronfg commented 6 years ago

love the progress you've made with this! Much appreciated

huextrat commented 6 years ago

@mitchhymel Apparently the maxSdkVersion must be at least the 18, otherwise the app is not accepted on the PlayStore

mitchhymel commented 6 years ago

@huextrat I have little experience with the Play store so I didn't realize this. But I'm curious: does the Play Store block the app if one permission's maxSdkVersion is <18 or if the entire app's maxSdkVersion is <18? The workaround I suggested means that the app only requests Vibrate permissions on SDK 16 and 17. I didn't want to require all users of this library to have to add Vibrate permissions to their apps to all versions. However, if this prevents apps from being uploaded to the Play store, then I need to think of another solution.

huextrat commented 6 years ago

@mitchhymel I don't really know but I uploaded it on the PlayStore and I got an alert because the permission for vibration had to be equal 18 at least. So I just updated to maxSdk 18 the permission and it works fine, I can't test it atm on low SDK.

I never got this error before because you don't have to set the maxSdkVersion if you use the NotificationBuilder in Android. But I think if we don't set the maxSdk for the vibration it can works. It's not a big deal to ask for vibration permission on every phones.

mitchhymel commented 6 years ago

Ok. Makes sense to just ask that users of the library add the Vibrate permission if they intend to support sdk 16 and 17 in their apps. I updated the readme so that it doesn't have the "maxSdkVersion".