示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            devicesAdapter         = new DevicesListAdapter(this, Common.ListManager);
            listView               = FindViewById <ListView>(Resource.Id.listView1);
            listView.Adapter       = devicesAdapter;
            listView.ItemClick    += ListView_ItemClick;
            listView.ItemSelected += ListView_ItemSelected;

            mainActions = FindViewById <RelativeLayout>(Resource.Id.main_actions);
            mainShare   = FindViewById <RelativeLayout>(Resource.Id.main_share);

            devicesListLayout = FindViewById <LinearLayout>(Resource.Id.main_devicesListLayout);
            bannerLayout      = FindViewById <RelativeLayout>(Resource.Id.main_banner);

            startSessionListener = new CallbackStartSessionListener(this);
            showBannerAdListener = new CallbackShowBanner(this);
            RevMob.StartWithListener(this, startSessionListener, Droid.Config.Secrets.RevMobId);
            UserTrialStatusUpdated();
            TrialHelper.UserTrialStatusChanged += UserTrialStatusUpdated;
            RefreshUserTrialStatus();

            if ((Intent.Action == Intent.ActionSend) || (Intent.Action == Intent.ActionSendMultiple))
            {
                OnCreate_Share();
            }
            else
            {
                OnCreate_Main();
            }

            SetButtonsEnableStatus(false);

            UpdateSelectedRemoteSystem();

            if (IsInitialized)
            {
                return;
            }
            IsInitialized = true;

            Common.PackageManager = new RomePackageManager(this);
            Common.PackageManager.Initialize("com.roamit.service");

            Common.MessageCarrierPackageManager = new RomePackageManager(this);
            Common.MessageCarrierPackageManager.Initialize("com.roamit.messagecarrierservice");

            Common.PackageManager.RemoteSystems.CollectionChanged += RemoteSystems_CollectionChanged;

            InitDiscovery();
        }
示例#2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.WebViewContainer);

            webView = FindViewById <WebView>(Resource.Id.webView);
            var client = new HybridWebViewClient(this);

            webView.SetWebViewClient(client);
            webView.Settings.JavaScriptEnabled = true;

            var settings = new Classes.Settings(this);

            if (IsShareDialog)
            {
                InitShareDialog();
            }
            else
            {
                if (settings.Theme == AppTheme.Dark)
                {
                    webView.LoadUrl($"{homeUrl}#dark");
                }
                else
                {
                    webView.LoadUrl($"{homeUrl}#light");
                }

                ShowWhatsNewIfNecessary();
            }


            bannerLayout         = FindViewById <RelativeLayout>(Resource.Id.webViewContainer_banner);
            startSessionListener = new CallbackStartSessionListener(this);
            showBannerAdListener = new CallbackShowBanner(this);
            RevMob.StartWithListener(this, startSessionListener, Droid.Config.Secrets.RevMobId);
            UserTrialStatusUpdated();
            TrialHelper.UserTrialStatusChanged += UserTrialStatusUpdated;
            RefreshUserTrialStatus();


            checkClipboardTextTimer = new System.Timers.Timer()
            {
                Interval = 1000,
            };
            checkClipboardTextTimer.Elapsed += CheckClipboardTextTimer_Elapsed;
            checkClipboardTextTimer.Start();

            if (IsInitialized)
            {
                Common.PackageManager.RemoteSystems.CollectionChanged += DevicesCollectionChanged;
                Common.AndroidPushNotifier.Devices.CollectionChanged  += DevicesCollectionChanged;
                return;
            }
            IsInitialized = true;

            if (Common.PackageManager == null)
            {
                Common.PackageManager = new RomePackageManager(this);
                Common.PackageManager.Initialize("com.roamit.service");
            }
            else
            {
                foreach (var item in Common.PackageManager.RemoteSystems)
                {
                    Common.ListManager.AddDevice(item);
                }
            }

            if (Common.AndroidPushNotifier == null)
            {
                InitAndroidPushNotifier();
            }
            else
            {
                foreach (var item in Common.AndroidPushNotifier.Devices)
                {
                    Common.ListManager.AddDevice(item);
                }

                Common.AndroidPushNotifier.Devices.CollectionChanged -= DevicesCollectionChanged;
                Common.AndroidPushNotifier.Devices.CollectionChanged += DevicesCollectionChanged;
            }

            if (Common.MessageCarrierPackageManager == null)
            {
                Common.MessageCarrierPackageManager = new RomePackageManager(this);
                Common.MessageCarrierPackageManager.Initialize("com.roamit.messagecarrierservice");
            }

            InitRomeDiscovery();

            Context context = this;

            Task.Run(async() =>
            {
#if DEBUG
                FirebaseInstanceId.Instance.DeleteInstanceId();
#endif
                await ServiceFunctions.RegisterDevice(context);
                RefreshUserTrialStatus();
            });

            Analytics.TrackPage("WebViewContainerActivity");

            if (settings.AllowToStayInBackground)
            {
                StartService(new Intent(this, typeof(Services.RomeReadyService)));
            }

            CheckForLegacyVersionInstallations();
        }
 public void Initialize(string apiKey)
 {
     RevMob.StartWithListener(Game.Activity, startSessionListener, apiKey);
 }