Please note that there are a number of breaking changes in this release to improve the developer experience when using the plugin APIs. The changes should hopefully be straightforward but please through the changelog carefully just in case. The steps migrate your code has been covered below but the Git history of the example application's main.dart file can also be used as reference.
-
[Android] BREAKING CHANGE The
styleproperty of theAndroidNotificationDetailsclass has been removed as it was redundant. No changes are needed unless your application was displaying media notifications (i.e.stylewas set toAndroidNotificationStyle.Media). If this is the case, you can migrate your code by setting thestyleInformationproperty of theAndroidNotificationDetailsto an instance of theMediaNotificationStyleInformationclass. This class is a new addition in this release -
[Android] BREAKING CHANGE The
AndroidNotificationSoundabstract class has been introduced to represent Android notification sounds. Thesoundproperty of theAndroidNotificationDetailsclass has changed from being aStringtype to anAndroidNotificationSoundtype. In this release, theAndroidNotificationSoundhas the following subclasses-
RawResourceAndroidNotificationSound: use this when the sound is raw resource associated with the Android application. Previously, this was the only type of sound supported so applications using the plugin prior to 1.4.0 can migrate their application by using this class. For example, if your previous code wasvar androidPlatformChannelSpecifics = AndroidNotificationDetails( 'your other channel id', 'your other channel name', 'your other channel description', sound: 'slow_spring_board');
Replace it with
var androidPlatformChannelSpecifics = AndroidNotificationDetails( 'your other channel id', 'your other channel name', 'your other channel description', sound: RawResourceAndroidNotificationSound('slow_spring_board');
-
UriAndroidNotificationSound: use this when a URI refers to the sound on the Android device. This is a new feature being supported as part of this release. Developers may need to write their code to access native Android APIs (e.g. theRingtoneManagerAPIs) to obtain the URIs they need.
-
-
[Android] BREAKING CHANGE The
BitmapSourceenum has been replaced by the newlyAndroidBitmapabstract class and its subclasses. This removes the need to specify the name/path of the bitmap and the source of the bitmap as two separate properties (e.g. thelargeIconandlargeIconBitmapSourceproperties of theAndroidNotificationDetailsclass). This change affects the following classesAndroidNotificationDetails: thelargeIconis now anAndroidBitmaptype instead of aStringand thelargeIconBitmapSourceproperty has been removedBigPictureStyleInformation: thelargeIconis now anAndroidBitmaptype instead of aStringand thelargeIconBitmapSourceproperty has been removed. ThebigPictureis now aAndroidBitmaptype instead of aStringand thebigPictureBitmapSourceproperty has been removed
The following describes how each
BitmapSourcevalue maps to theAndroidBitmapsubclassesBitmapSource.Drawable->DrawableResourceAndroidBitmapBitmapSource.FilePath->FilePathAndroidBitmap
Each of these subclasses has a constructor that an argument referring to the bitmap itself. For example, if you previously had the following code
var androidPlatformChannelSpecifics = AndroidNotificationDetails( 'your other channel id', 'your other channel name', 'your other channel description', largeIcon: 'sample_large_icon', largeIconBitmapSource: BitmapSource.Drawable, )
This would now be replaced with
var androidPlatformChannelSpecifics = AndroidNotificationDetails( 'your other channel id', 'your other channel name', 'your other channel description', largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'), )
-
[Android] BREAKING CHANGE The
IconSourceenum has been replaced by the newly addedAndroidIconabstract class and its subclasses. This change was done for similar reasons in replacing theBitmapSourceenum. This only affects thePersonclass, which is used when displaying each person in a messaging-style notification. Here theiconproperty is now anAndroidIcontype instead of aStringand theiconSourceproperty has been removed.The following describes how each
IconSourcevalue maps to theAndroidIconsubclassesIconSource.Drawable->DrawableResourceAndroidIconIconSource.FilePath->BitmapFilePathAndroidIconIconSource.ContentUri->ContentUriAndroidIcon
Each of these subclasses has a constructor that accepts an argument referring to the icon itself. For example, if you previously had the following code
Person( icon: 'me', iconSource: IconSource.Drawable, )
This would now be replaced with
Person( icon: DrawableResourceAndroidIcon('me'), )
The
AndroidIconalso has aBitmapAssetAndroidIconsubclass to enables the usage of bitmap icons that have been registered as a Flutter asset via thepubspec.yamlfile. -
[Android] BREAKING CHANGE All properties in the
AndroidNotificationDetails,DefaultStyleInformationandInboxStyleInformationclasses have been madefinal -
The
DefaultStyleInformationclass now implements theStyleInformationclass instead of extending it -
Where possible, classes in the plugins have been updated to provide
constconstructors -
Updates to API docs and readme
-
Bump Android dependencies
-
Fixed a grammar issue 0.9.1 changelog entry