Browse Source

Few Required nuget packages added

master
Kaustav Chaudhuri 1 year ago
parent
commit
f8901f2c8f
2 changed files with 128 additions and 0 deletions
  1. +2
    -0
      GMCabsDriverAssistantSolution/GMCabsDriverAssistantSolution.csproj
  2. +126
    -0
      GMCabsDriverAssistantSolution/Platforms/Android/GMCabsDriverAssistantApplication.cs

+ 2
- 0
GMCabsDriverAssistantSolution/GMCabsDriverAssistantSolution.csproj View File

@ -105,8 +105,10 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.0-preview2" />
<PackageReference Include="Plugin.FirebasePushNotification" Version="3.4.35" />
<PackageReference Include="QRCoder" Version="1.4.3" />
<PackageReference Include="Sentry" Version="3.30.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="Xam.Plugin.SimpleAudioPlayer" Version="1.6.0" />
</ItemGroup>
<ItemGroup>


+ 126
- 0
GMCabsDriverAssistantSolution/Platforms/Android/GMCabsDriverAssistantApplication.cs View File

@ -0,0 +1,126 @@
using Android.App;
using Android.OS;
using Android.Runtime;
using Android.Util;
using AndroidX.Core.App;
using Plugin.FirebasePushNotification;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GMCabsDriverAssistantSolution.Platforms.Android
{
#if DEBUG
[Application(Debuggable = true, NetworkSecurityConfig = "@xml/network_security_config")]
#else
[Application(Debuggable = false)]
#endif
//[MetaData("com.google.firebase.messaging.default_notification_icon", Resource = "@drawable/ic_stat_ic_notification")]
//[MetaData("com.google.firebase.messaging.default_notification_color", Resource = "@color/color_notification_icon")]
public class GMCabsDriverAssistantApplication : Microsoft.Maui.Controls.Application
{
// #region Constants
// public const string TAG = nameof(GMCabsDriverAssistantApplication);
// public static string SILENT_NOTIFICATION_CHANNEL_ID = "GMCabsDriverAssistantSilentNotificationChannel";
// public static string SILENT_NOTIFICATION_CHANNEL_NAME = "GM Cabs Silent Notification Channel";
// public static string SOUND_NOTIFICATION_CHANNEL_ID = "GMCabsDriverAssistantChannel";
// public static string SOUND_NOTIFICATION_CHANNEL_NAME = "GM Cabs Notification Channel";
// public static string SYSTEM_SOUND_NOTIFICATION_CHANNEL_ID = "GMCabsDriverAssistantSystemChannel";
// public static string SYSTEM_SOUND_NOTIFICATION_CHANNEL_NAME = "GM Cabs System Notification Channel";
// #endregion
// public GMCabsDriverAssistantApplication(IntPtr handle, JniHandleOwnership transfer)
// : base(handle, transfer)
// {
// }
// public override void OnCreate()
// {
// base.OnCreate();
// //FirebasePushNotificationManager.Initialize(this, true);
// FirebasePushNotificationManager.Initialize(this, false);
// CrossFirebasePushNotification.Current.OnNotificationReceived += Current_OnNotificationReceived;
// }
// [Obsolete]
// private void Current_OnNotificationReceived(object source, FirebasePushNotificationDataEventArgs e)
// {
// var soundFileName = "newbooking";
// Log.Debug(TAG, "Received on Android");
// string channelId = string.Empty;
// string channelName = string.Empty;
// NotificationCompat.Builder notificationBuilder = null;
// NotificationChannel channel = null;
// var data = e.Data;
// if (data != null && e.Data.ContainsKey("title"))
// {
// /* Custom Sound Notification Channel */
// if (data["title"].ToString() == "Booking Available")
// {
// channelId = SOUND_NOTIFICATION_CHANNEL_ID;
// channelName = SOUND_NOTIFICATION_CHANNEL_NAME;
// notificationBuilder = new NotificationCompat
// .Builder(this, channelId)
// .SetSmallIcon(Resource.Drawable.ic_stat_ic_notification)
// //.SetColor(GetColor(Resource.Color.color_notification_icon))
// .SetContentTitle(data.ContainsKey("title") ? data["title"].ToString() : "")
// .SetContentText(data.ContainsKey("body") ? data["body"].ToString() : "")
// .SetPriority((int)NotificationImportance.Max)
// .SetAutoCancel(true);
// channel = new NotificationChannel(channelId, channelName, NotificationImportance.Max);
// channel.SetSound(global::Android.Net.Uri.Parse("android.resource://au.com.gmcabs.driverassistant/raw/" + soundFileName), null);
// }
// /* Silent Notification Channel */
// else if (data["title"].ToString() == "Configuration")
// {
// channelId = SILENT_NOTIFICATION_CHANNEL_ID;
// channelName = SILENT_NOTIFICATION_CHANNEL_NAME;
// notificationBuilder = new NotificationCompat
// .Builder(this, channelId)
// .SetSmallIcon(Resource.Drawable.ic_stat_ic_notification)
// //.SetColor(GetColor(Resource.Color.color_notification_icon))
// .SetContentTitle(data.ContainsKey("title") ? data["title"].ToString() : "")
// .SetContentText(data.ContainsKey("body") ? data["body"].ToString() : "")
// .SetPriority((int)NotificationImportance.Low)
// .SetNotificationSilent()
// .SetAutoCancel(true);
// channel = new NotificationChannel(channelId, channelName, NotificationImportance.Low);
// }
// /* System Sound Notification Channel */
// else
// {
// channelId = SYSTEM_SOUND_NOTIFICATION_CHANNEL_ID;
// channelName = SYSTEM_SOUND_NOTIFICATION_CHANNEL_NAME;
// notificationBuilder = new NotificationCompat
// .Builder(this, channelId)
// .SetSmallIcon(Resource.Drawable.ic_stat_ic_notification)
// //.SetColor(GetColor(Resource.Color.color_notification_icon))
// .SetContentTitle(data.ContainsKey("title") ? data["title"].ToString() : "")
// .SetContentText(data.ContainsKey("body") ? data["body"].ToString() : "")
// .SetPriority((int)NotificationImportance.Max)
// .SetAutoCancel(true);
// channel = new NotificationChannel(channelId, channelName, NotificationImportance.Max);
// }
// NotificationManager notificationManager = (NotificationManager)GetSystemService(NotificationService);
// if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
// {
// notificationManager.CreateNotificationChannel(channel);
// }
// notificationManager.Notify(DateTime.Now.Millisecond, notificationBuilder.Build());
// }
// }
}
}

Loading…
Cancel
Save