コード例 #1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            // Use Firebase library to configure APIs
            App.Configure();

            // You can set default parameter values using an NSDictionary object or a plist file.
            var defaultPlist = NSBundle.MainBundle.PathForResource("RemoteConfigDefaults", "plist");

            if (defaultPlist != null)
            {
                RemoteConfig.SharedInstance.SetDefaults("RemoteConfigDefaults");
            }
            else
            {
                object [] values        = { 5, 20 };
                object [] keys          = { "times_table", "from_zero_to" };
                var       defaultValues = NSDictionary.FromObjectsAndKeys(values, keys, keys.Length);
                RemoteConfig.SharedInstance.SetDefaults(defaultValues);
            }

            (Window.RootViewController as UINavigationController).PushViewController(new RemoteConfigViewController(), true);

            return(true);
        }
コード例 #2
0
    public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
    {
        // create a new window instance based on the screen size
        Window = new UIWindow(UIScreen.MainScreen.Bounds);

        // You can download your GoogleService-Info.plist file following the next link:
        // https://firebase.google.com/docs/ios/setup
        if (!GoogleServiceInfoPlistHelper.FileExist())
        {
            Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
            return(true);
        }

        var coreType          = typeof(Firebase.Core.App);
        var installationsType = typeof(Firebase.Installations.Installations);
        var analyticsType     = typeof(Firebase.Analytics.Analytics);

        Firebase.Core.App.Configure();

        // create a UIViewController with a single UILabel
        var vc = new UIViewController();

        vc.View !.AddSubview(new UILabel(Window !.Frame)
        {
            BackgroundColor = UIColor.White,
            TextColor       = UIColor.Black,
            TextAlignment   = UITextAlignment.Center,
            Lines           = 0,
            Text            = $"Hello, iOS!\nRunning {nameof (AnalyticsSample)} with .net6.0!"
        });
コード例 #3
0
        public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            Firebase.Core.App.Configure();

            var instanceId      = Firebase.InstanceID.InstanceId.SharedInstance;
            var remoteConfig    = Firebase.RemoteConfig.RemoteConfig.SharedInstance;
            var installations   = Firebase.Installations.Installations.DefaultInstance;
            var abTesting       = Firebase.ABTesting.ExperimentController.SharedInstance;
            var common          = new Firebase.MLKit.ModelInterpreter.CustomRemoteModel("Dummy");
            var naturalLanguage = Firebase.MLKit.NaturalLanguage.NaturalLanguageApi.DefaultInstance;
            var vision          = Firebase.MLKit.Vision.VisionApi.Create();

            return(true);
        }
コード例 #4
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            var navigationController = Window.RootViewController as UINavigationController;

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                UINavigationBar.Appearance.LargeTitleTextAttributes = new UIStringAttributes {
                    ForegroundColor = UIColor.White
                }
            }
            ;

            var remoteConfig = RemoteConfig.SharedInstance;

            // You can set default parameter values using an NSDictionary object or a plist file.
            var defaultPlist = NSBundle.MainBundle.PathForResource("RemoteConfigDefaults", "plist");

            if (defaultPlist != null)
            {
                // Load in-app defaults from a plist file that sets perf_enable_auto and
                // perf_enable_manual to true until you update values in the Firebase Console.
                remoteConfig.SetDefaults("RemoteConfigDefaults");
            }
            else
            {
                // If the plist file doesn't exist, load the values by code.
                object [] values        = { true, true };
                object [] keys          = { "perf_enable_auto", "perf_enable_manual" };
                var       defaultValues = NSDictionary.FromObjectsAndKeys(values, keys, keys.Length);
                remoteConfig.SetDefaults(defaultValues);
            }

            // Important! This needs to be applied before App.Configure()
            var isPerformanceMonitoringInstrumentationEnabled = remoteConfig ["perf_enable_auto"].BoolValue;
            var isPerformanceMonitoringDataCollectionEnabled  = remoteConfig ["perf_enable_manual"].BoolValue;

            // The following line enables/disables automatic traces and HTTP/S network monitoring
            Performance.SharedInstance.InstrumentationEnabled = isPerformanceMonitoringInstrumentationEnabled;

            // The following line enables/disables custom traces
            Performance.SharedInstance.DataCollectionEnabled = isPerformanceMonitoringDataCollectionEnabled;

            // Use Firebase library to configure APIs
            App.Configure();

            return(true);
        }
コード例 #5
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            App.Configure();

            return(true);
        }
コード例 #6
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            App.Configure();

            return(true);
        }
コード例 #7
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            (Window.RootViewController as UINavigationController).PushViewController(new UserInfoViewController(this), true);
            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            App.Configure();

            // Register your app for remote notifications.
            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                // For iOS 10 display notification (sent via APNS)
                UNUserNotificationCenter.Current.Delegate = this;

                var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
                UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => {
                    Console.WriteLine(granted);
                });
            }
            else
            {
                // iOS 9 or before
                var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
                var settings             = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);
                UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            }

            UIApplication.SharedApplication.RegisterForRemoteNotifications();

            Messaging.SharedInstance.Delegate = this;

            InstanceId.SharedInstance.GetInstanceId(InstanceIdResultHandler);

            return(true);
        }
コード例 #8
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            (Window.RootViewController as UINavigationController).PushViewController(new MenuViewController(), true);

            App.Configure();

            return(true);
        }
コード例 #9
0
        public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            Firebase.Core.App.Configure();

            var installations = Firebase.Installations.Installations.DefaultInstance;
            var abTesting     = Firebase.ABTesting.ExperimentController.SharedInstance;

            return(true);
        }
コード例 #10
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            (Window.RootViewController as UINavigationController).PushViewController(new AdsViewController(), true);

            App.Configure();

            /*
             * In your app's Info.plist file, add a GADApplicationIdentifier key
             * with a string value of your AdMob app ID
             *
             * <key>GADApplicationIdentifier</key>
             * <string>ca-app-pub-XXXXXXXXXXXXXXXX~NNNNNNNNNN</string>
             *
             * Get your Application Id here: https://apps.admob.com/#account/appmgmt:
             *
             * If you're just looking to experiment with the SDK in a Hello World app,
             * you can use the sample App ID shown below.
             *
             * <string>ca-app-pub-3940256099942544~1458002511</string>
             */

            MobileAds.SharedInstance.Start(status => {
                // Requests test ads on devices you specify. Your test device ID is printed to the console when
                // an ad request is made. Ads automatically returns test ads when running on a
                // simulator. After you get your device ID, add it here
                MobileAds.SharedInstance.RequestConfiguration.TestDeviceIdentifiers = new [] { Request.SimulatorId.ToString() };
            });

            return(true);
        }
コード例 #11
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            UINavigationBar.Appearance.TintColor = UIColor.White;

            App.Configure();

            RootNode = Database.DefaultInstance.GetRootReference().GetChild("storage");

            return(true);
        }
コード例 #12
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            navigationController      = new UINavigationController(new MainViewController());
            Window.RootViewController = navigationController;
            Window.MakeKeyAndVisible();

            App.Configure();

            return(true);
        }
コード例 #13
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            UINavigationBar.Appearance.TintColor           = UIColor.White;
            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            // Set DeepLinkUrlScheme to the custom URL scheme you defined in your
            // Info.plist.
            Options.DefaultInstance.DeepLinkUrlScheme = "com.xamarin.firebase.ios.dynamiclinkssample";
            App.Configure();

            return(true);
        }
コード例 #14
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // You can download your GoogleService-Info.plist file following the next link:
            // https://firebase.google.com/docs/ios/setup
            if (!GoogleServiceInfoPlistHelper.FileExist())
            {
                Window = GoogleServiceInfoPlistHelper.CreateWindowWithFileNotFoundMessage();
                return(true);
            }

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            (Window.RootViewController as UINavigationController).PushViewController(new MenuViewController(), true);

            App.Configure();

            Settings.AppId       = appId;
            Settings.DisplayName = appName;

            // This method verifies if you have been logged to Facebook into the app before, and keep you logged in after you reopen or kill your app.
            return(ApplicationDelegate.SharedInstance.FinishedLaunching(application, launchOptions));
        }