protected override void OnNewIntent(Intent intent)
        {
            Log.Info("BissAndroidMainActivity", "OnNewIntent: " + intent?.Extras);

            // Fix für doppelten Notification Empfang falls auf die Push Nachricht getapt worden ist.
            intent.AddFlags(ActivityFlags.ClearTop);

            base.OnNewIntent(intent);
            //if (Constants.AppNeedInternet)
            //{
            //    Push.CheckLaunchedFromNotification(this, intent);
            //}

            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);
            }
        }
        public void OnActivityDestroyed(Activity activity)
        {
            // Keine Ahnung warum, aber wenn die App von einem Toast wieder in den Vordergrund gebracht wird, kommen die Extras mit den Notification infos nur hierher

            Log.Info("BissAndroidMainApp", "OnActivityDestroyed: " + activity?.Intent?.Extras);

            var intent = activity?.Intent;

            if (intent?.Extras != null)
            {
                var dict = new Dictionary <string, string>();

                foreach (var key in intent.Extras.KeySet())
                {
                    if (key.StartsWith("com.microsoft.intune") || key == "profile")
                    {
                        continue;
                    }

                    var value = intent.Extras.Get(key);
                    Log.Debug("BissAndroidMainActivity", "Key: {0} Value: {1}", key, value);

                    dict.Add(key, value.ToString());
                }

                if (dict.Any())
                {
                    // Launched from Notification or Toast
                    ProjectViewModelBase.PushReceived(dict);
                }
            }
        }
        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);
        }
Exemple #4
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (!(Window.Current.Content is Frame rootFrame))
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;

                // beim Store Build werden die Assemblies aus Nuget Packages nicht richtig mitgeladen, hiermit behoben
                var rendererAssemblies = new[]
                {
                    // Die nicht im Projekt benötigten Renderer können entfernt werden
                    typeof(CartesianChartRenderer).GetTypeInfo().Assembly,
                    typeof(LegendRenderer).GetTypeInfo().Assembly,
                    typeof(PieChartRenderer).GetTypeInfo().Assembly,
                    typeof(PieLabelRenderer).GetTypeInfo().Assembly,
                    typeof(CardActionViewRenderer).GetTypeInfo().Assembly,
                    typeof(ChatListViewRenderer).GetTypeInfo().Assembly,
                    typeof(ListViewRenderer).GetTypeInfo().Assembly,
                    typeof(TreeViewRenderer).GetTypeInfo().Assembly,
                    typeof(ItemsControlRenderer).GetTypeInfo().Assembly,
                    typeof(AutoCompleteLabelRenderer).GetTypeInfo().Assembly,
                    typeof(AutoCompleteRenderer).GetTypeInfo().Assembly,
                    typeof(ButtonRenderer).GetTypeInfo().Assembly,
                    typeof(CalendarRenderer).GetTypeInfo().Assembly,
                    typeof(DataFormRenderer).GetTypeInfo().Assembly,
                    typeof(EntryRenderer).GetTypeInfo().Assembly,
                    typeof(MaskedInputRenderer).GetTypeInfo().Assembly,
                    typeof(SegmentedControlRenderer).GetTypeInfo().Assembly,
                    typeof(TimePickerItemViewRenderer).GetTypeInfo().Assembly,
                    typeof(BorderRenderer).GetTypeInfo().Assembly,
                    typeof(CheckBoxRenderer).GetTypeInfo().Assembly,
                    typeof(ScrollViewRenderer).GetTypeInfo().Assembly,
                    typeof(SideDrawerRenderer).GetTypeInfo().Assembly,
                    typeof(SlideViewLabelRenderer).GetTypeInfo().Assembly,
                    typeof(SlideViewRenderer).GetTypeInfo().Assembly,
                    typeof(TabViewHeaderItemRenderer).GetTypeInfo().Assembly,
                    typeof(ZXingBarcodeImageViewRenderer).GetTypeInfo().Assembly,
                    typeof(ZXingScannerViewRenderer).GetTypeInfo().Assembly,
                    typeof(WriteableBitmapRenderer).GetTypeInfo().Assembly,
                    typeof(PixelDataRenderer).GetTypeInfo().Assembly,
                    typeof(SvgRenderer).GetTypeInfo().Assembly,
                    typeof(SKCanvasViewRenderer).GetTypeInfo().Assembly,
                    typeof(SKGLViewRenderer).GetTypeInfo().Assembly
                };

                Forms.Init(e, rendererAssemblies);
                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }

            // Azure Mobile Center Push Notifizierungen
            Push.CheckLaunchedFromNotification(e);

            if (e.Arguments != null)
            {
                var customData = ParseLaunchString(e.Arguments);

                if (customData != null)
                {
                    foreach (var data in customData)
                    {
                        Logging.Log.LogInfo("NotificationData: " + data.Key + ": " + data.Value);
                    }

                    ProjectViewModelBase.PushReceived(customData);
                }
            }
        }