protected override void OnCreate(Bundle bundle) { var parameters = new object[] { AppSettings.Current().ProjectWorkUserFolder, this, bundle, new PlatformOptions { SmallIconDrawable = Resource.Drawable.ic_notification }, }; var initializer = new BissInitializer(); if (!initializer.Initialize(parameters)) { throw new ApplicationException("Initialization failed"); } TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); FormsMaps.Init(this, bundle); InitializeDisplayOrientations(); Platform.Init(); LoadApplication(new App(initializer)); if (Intent?.Extras != null) { var dict = new Dictionary <string, string>(); foreach (var key in Intent.Extras.KeySet()) { var value = Intent.Extras.Get(key); Log.Debug("BissAndroidMainActivity", "Key: {0} Value: {1}", key, value); dict.Add(key, value.ToString()); } ProjectViewModelBase.PushReceived(dict); } var pushOk = PushAzure.Init(this, NotificationService); }
public MainPage() { InitializeComponent(); var parameters = new object[] { AppSettings.Current().ProjectWorkUserFolder }; var initializer = new BissInitializer(); if (!initializer.Initialize(parameters)) { throw new ApplicationException("Initialization failed"); } ZXingScannerViewRenderer.Init(); FormsMaps.Init(AppSettings.Current().BingMapsApplicationId); NativeCustomize(); LoadApplication(new BaseApp.App(initializer)); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // General Initialization var initializer = new BissInitializer(); var parameters = new object[] { AppSettings.Current().ProjectWorkUserFolder }; // Just throwing an exception for now. if (!initializer.Initialize(parameters)) { throw new ApplicationException("Initialization failed"); } InitializeDisplayOrientations(); UIApplication.SharedApplication.RegisterForRemoteNotifications(); UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; if (Constants.AppNeedInternet) { PushExtension.BcInitPush(null); //Notifizeirungen global auch wenn die App im Vordergrund läuft => Besser über VmBase. ... .Badge //UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate(); // Request notification permissions from the user UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert, async(approved, err) => { // Handle approval if (!approved) { await Task.Delay(200); // Beim Erststart nach installation ist approved immer False - deshalb nochmal checken, ob wirklich abgelehnt. UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert, async(approved2, err2) => { await PushExtension.BcPush(null).EnablePush(approved2); }); } else { await PushExtension.BcPush(null).EnablePush(approved); } }); } var remoteNotificationInfo = launchOptions?.ObjectForKey(UIApplication.LaunchOptionsRemoteNotificationKey); var localNotificationInfo = launchOptions?.ObjectForKey(UIApplication.LaunchOptionsLocalNotificationKey); if (remoteNotificationInfo != null) { Logging.Log.LogInfo("Launch From Remote Notification"); Console.WriteLine("BissIos: Launch remote Notification: " + remoteNotificationInfo); var remoteNotification = remoteNotificationInfo as NSDictionary; var aps = remoteNotification.ObjectForKey(new NSString("aps")); var apsDict = aps as NSDictionary; var alert = apsDict?.ObjectForKey(new NSString("alert")); var alertDict = alert as NSDictionary; var appCenter = remoteNotification.ObjectForKey(new NSString("mobile_center")); var appCenterDict = appCenter as NSDictionary; /* * { * aps = * { * alert = * { * body = ""; * title = ""; * }; * }; * "mobile_center"= * { * User = "******"; * UserID = 1; * }; * } */ var dict = new Dictionary <string, string>(); if (alertDict != null) { foreach (var custData in alertDict) { if (custData.Key is NSString key && custData.Value is NSString value) { dict.Add(key.ToString(), value.ToString()); } else { Logging.Log.LogError("Alert Data ist nicht ein String!"); } } }