Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Didn't find class "android.app.NotificationChannel"

$
0
0

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?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>