Firebase teszthez
This commit is contained in:
@@ -3,6 +3,8 @@ using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using Android.Nfc;
|
||||
using Android.OS;
|
||||
using Firebase;
|
||||
using Plugin.Firebase.CloudMessaging;
|
||||
using Plugin.NFC;
|
||||
|
||||
|
||||
@@ -40,12 +42,14 @@ namespace WorkFlowCheck.MAUI
|
||||
new Intent(this, typeof(MainActivity)).AddFlags(ActivityFlags.SingleTop),
|
||||
Build.VERSION.SdkInt >= BuildVersionCodes.S ? PendingIntentFlags.Mutable : PendingIntentFlags.UpdateCurrent);
|
||||
|
||||
HandleIntent(Intent);
|
||||
CreateNotificationChannelIfNeeded();
|
||||
}
|
||||
|
||||
protected override void OnNewIntent(Intent intent)
|
||||
{
|
||||
base.OnNewIntent(intent);
|
||||
|
||||
HandleIntent(intent);
|
||||
CrossNFC.OnNewIntent(intent);
|
||||
|
||||
if (intent.Action == NfcAdapter.ActionTagDiscovered)
|
||||
@@ -85,5 +89,24 @@ namespace WorkFlowCheck.MAUI
|
||||
// nfcAdapter?.DisableForegroundDispatch(this);
|
||||
//}
|
||||
}
|
||||
private static void HandleIntent(Intent intent)
|
||||
{
|
||||
FirebaseCloudMessagingImplementation.OnNewIntent(intent);
|
||||
}
|
||||
private void CreateNotificationChannelIfNeeded()
|
||||
{
|
||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
|
||||
{
|
||||
CreateNotificationChannel();
|
||||
}
|
||||
}
|
||||
private void CreateNotificationChannel()
|
||||
{
|
||||
var channelId = $"{PackageName}.general";
|
||||
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
|
||||
var channel = new NotificationChannel(channelId, "General", NotificationImportance.Default);
|
||||
notificationManager.CreateNotificationChannel(channel);
|
||||
FirebaseCloudMessagingImplementation.ChannelId = channelId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user