Firebase teszthez
This commit is contained in:
@@ -15,6 +15,18 @@
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="default" />
|
||||
<receiver
|
||||
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
|
||||
android:exported="true"
|
||||
android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
@@ -23,5 +35,8 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-feature android:name="android.hardware.nfc" android:required="true" />
|
||||
</manifest>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<resources>
|
||||
<string name="com.google.firebase.crashlytics.mapping_file_id">none</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user