I just upgraded from 7.1 to 8.0 and in that context i also wanted to use the new notification channels, which is causing me trouble. The following snippet causes me issues:
[Activity(Label = "MyApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
NotificationManager = (NotificationManager)GetSystemService(Context.NotificationService);
var chan = new NotificationChannel(MAINCHANNEL, "New game", NotificationImportance.Default)
{
LockscreenVisibility = NotificationVisibility.Private
};
NotificationManager.CreateNotificationChannel(chan);
}
The error i get is:
Java.Lang.ClassNotFoundException: Didn't find class "android.app.NotificationChannel" on path: DexPathList[[zip file "/data/app/MyApp.MyApp-1/base.apk"],nativeLibraryDirectories=[/data/app/MyApp.MyApp-1/lib/arm, /data/app/MyApp.MyApp-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] occurred
Anyone got some input?