I’m following this guide for implementing an app that uses proximity beacon:
I downloaded the ExampleApp folder from github and installed Estimote.Android.Proximity. It work fine.
But this is my problem:
//ExampleApps/Example.Android.Proximity/MainActivity.cs
class MyEnterHandler : Java.Lang.Object, Kotlin.Jvm.Functions.IFunction1
{
public Java.Lang.Object Invoke(Java.Lang.Object p0)
{
IProximityZoneContext context = (IProximityZoneContext)p0;
Log.Debug("app", $"MyEnterHandler, context = {context}");
return null;
}
}
Instead of Log.Debug I want to create my Notification… How can I do it?
I tryed to create notification with this script:
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
// Android 8.0 and up require a channel for the notifications
var channel = new NotificationChannel(channelId, "Bluetooth activity", NotificationImportance.Low);
var notificationManager = this.GetSystemService(Context.NotificationService) as NotificationManager;
notificationManager.CreateNotificationChannel(channel);
}
var notification = new NotificationCompat.Builder(this, channelId)
.SetSmallIcon(global::Android.Resource.Drawable.IcDialogInfo)
.SetContentTitle("Proximity")
.SetContentText("Proximity demo is scanning for beacons")
.Build();
But I have the problem with this.getSystemService (I haven’t Context in “MyEnterHandler class”)