public static Tealium.ITealium GetTealium(Android.App.Application app)
        {
            if (!initialized)
            {
                initialized = true;

                //***********************************************************
                // 1. Mandatory configuration - this is platform specific
                //***********************************************************
                instanceManager = new TealiumInstanceManager(new TealiumInstanceFactoryDroid(app));
                TealiumConsts.InstanceManager = instanceManager;

                // provide the Tealium automatic lifecycle tracking delegate - without this TealiumInstanceFactoryDroid won't
                // be able to set automatic lifecycle tracking (not set will result in null and not being able to track lifecycle)
                //TealiumLifecycleManager.SetLifecycleAutoTracking = TealiumDroid.Lifecycle.TealiumLifecycleControlDelegation.SetLifecycleAutoTracking;


                //***********************************************************
                // 2. Optional configuration - this is cross-platform
                //***********************************************************

                // the below two steps are optional, but they demonstrate
                // how to use remote commands, dispatch validators and event listeners
                var commands = SetupRemoteCommands();
                TealiumAdvancedConfig advancedConfig = SetupAdvancedConfig();


                //***********************************************************
                // 3. Final configuration and Tealium instance creation - this is also cross-platform
                //***********************************************************

                if (TealiumConsts.Environment == "dev")
                {
                    Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);
                }

                TealiumConfig config = new TealiumConfig(TealiumConsts.InstanceId,
                                                         TealiumConsts.AccountName,
                                                         TealiumConsts.ProfileName,
                                                         TealiumConsts.Environment,
                                                         true,
                                                         commands,
                                                         advancedConfig);
                // Enable Consent Management
                config.IsConsentManagerEnabled = true;
                // Optionally set the initial consent status/categories.
                //config.InitialUserConsentStatus = ConsentManager.ConsentStatus.Consented;
                //config.InitialUserConsentCategories = ConsentManager.AllCategories;

                var tealium = instanceManager.CreateInstance(config);

                //***********************************************************
                // 4. Optionally add data sources - this is cross-platform too
                //***********************************************************

                SetupDataSources(tealium);
            }

            return(instanceManager.GetExistingInstance(TealiumConsts.InstanceId));
        }
Exemple #2
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            try
            {
                var app = new Android.App.Application();
                MobileBarcodeScanner.Initialize(app);

                var scanner = new MobileBarcodeScanner();
                scanner.TopText    = "Hold the camera up to the QR code\nAbout 6 inches away";
                scanner.BottomText = "Wait for the QR code to automatically scan!";

                //This will start scanning
                ZXing.Result result = await scanner.Scan();

                string[] lines = result.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

                ProductsModel productsModel = new ProductsModel()
                {
                    ProductId          = lines[0].Substring(lines[0].IndexOf('-') + 1),
                    SerialNo           = "1",
                    ProductDescription = lines[1].Substring(lines[1].IndexOf('-') + 1),
                    UnitPrice          = lines[2].Substring(lines[2].IndexOf('-') + 1),
                    SellPrice          = lines[3].Substring(lines[3].IndexOf('-') + 1),
                    Quantity           = lines[4].Substring(lines[4].IndexOf('-') + 1)
                };
                await Navigation.PushAsync(new ProductListPage(productsModel, UserId));
            }
            catch (Exception ex)
            {
                //await DisplayAlert("Error", ex.Message, "Ok");
            }
        }
        public async Task <string> ScanAsync()
        {
            var app = new Android.App.Application();

            MobileBarcodeScanner.Initialize(app);

            var options = new ZXing.Mobile.MobileBarcodeScanningOptions();

            options.PossibleFormats = new List <ZXing.BarcodeFormat>()
            {
                ZXing.BarcodeFormat.QR_CODE
            };

            var scanner = new ZXing.Mobile.MobileBarcodeScanner();
            var result  = await scanner.Scan(options);

            if (result != null)
            {
                return(result.Text);
            }
            else
            {
                return(null);
            }
        }
Exemple #4
0
        public Scanner(Android.App.Application app)
        {
//            MobileBarcodeScanner.Initialize(app);
            // m_scanner = new MobileBarcodeScanner();
//            m_scanner.Dispatcher = dispatcher; // this is what they did in the sample -- don't know why its necessary...
            m_scannerControl = new ZXingScannerFragment();
        }
Exemple #5
0
        public static void Uninitialize(Android.App.Application app)
        {
            var version = Build.VERSION.SdkInt;

            if (version >= BuildVersionCodes.IceCreamSandwich)
            {
                app.UnregisterActivityLifecycleCallbacks(lifecycleListener);
            }
        }
Exemple #6
0
        public static void Initialize(Android.App.Application app)
        {
            var version = Build.VERSION.SdkInt;

            if (version >= BuildVersionCodes.IceCreamSandwich)
            {
                _lifecycleListener = new ActivityLifecycleContextListener();
                app.RegisterActivityLifecycleCallbacks(_lifecycleListener);
            }
        }
        private async void Continue_Shopping_Button_Clicked(object sender, System.EventArgs e)
        {
            try
            {
                var app = new Android.App.Application();
                MobileBarcodeScanner.Initialize(app);

                var scanner = new MobileBarcodeScanner();
                scanner.TopText    = "Hold the camera up to the QR code\nAbout 6 inches away";
                scanner.BottomText = "Wait for the QRcode to automatically scan!";

                //This will start scanning
                ZXing.Result result = await scanner.Scan();

                string[] lines = result.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

                string nxtSerialNo = Convert.ToString(ProductsList.Count + 1);

                ProductsModel productsModel = new ProductsModel()
                {
                    ProductId          = lines[0].Substring(lines[0].IndexOf('-') + 1),
                    SerialNo           = nxtSerialNo,
                    ProductDescription = lines[1].Substring(lines[1].IndexOf('-') + 1),
                    UnitPrice          = lines[2].Substring(lines[2].IndexOf('-') + 1),
                    SellPrice          = lines[3].Substring(lines[3].IndexOf('-') + 1),
                    Quantity           = lines[4].Substring(lines[4].IndexOf('-') + 1)
                };

                ProductsModel productsModelData = (from row in ProductsList where row.ProductId == productsModel.ProductId select row).FirstOrDefault();
                if (productsModelData != null)
                {
                    ProductsList.Remove(productsModelData);
                    productsModelData.Quantity = Convert.ToString(Convert.ToInt32(productsModelData.Quantity) + 1);
                    ProductsList.Add(productsModelData);
                    prodAddedPrice = Convert.ToDecimal(productsModelData.SellPrice);
                }
                else
                {
                    productsModelData = productsModel;
                    ProductsList.Add(productsModel);
                    prodAddedPrice = Convert.ToDecimal(productsModel.SellPrice);
                }

                TotalAmount.Text = Convert.ToString(Convert.ToDecimal(TotalAmount.Text) + prodAddedPrice);

                ProductsView.ItemsSource  = null;
                ProductsView.ItemsSource  = ProductsList;
                ProductsView.SelectedItem = null;
                ProductsView.SelectedItem = productsModelData;
            }
            catch (Exception ex)
            {
                await  DisplayAlert("Exception", ex.Message, "Ok");
            }
        }
 public static void Uninitialize(Android.App.Application app)
 {
 }
 public static void Initialize(Android.App.Application app)
 => Xamarin.Essentials.Platform.Init(app);
 public static void Uninitialize(Android.App.Application app)
 {
     app.UnregisterActivityLifecycleCallbacks(lifecycleListener);
 }
        public static AutoSuspendHelper Initialize(

#if __ANDROID__
            Android.App.Application application
 public static void Initialize(Android.App.Application application, string apiKey, string appId)
 {
     IO.Intercom.Android.Intercom.Initialize(application, apiKey, appId);
 }