Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.sample_cam);

            Title = "3d model";

            worldUrl = "Wikitude/3DModel/index.html";

            architectView = FindViewById <ArchitectView>(Resource.Id.architectView);
            ArchitectStartupConfiguration startupConfiguration = new ArchitectStartupConfiguration();

            startupConfiguration.setLicenseKey(Constants.WIKITUDE_SDK_KEY);
            startupConfiguration.setFeatures(ArchitectStartupConfiguration.Features.Tracking2D);
            startupConfiguration.setCameraResolution(CameraSettings.CameraResolution.Auto);

            /* use
             * int requiredFeatures = StartupConfiguration.Features.Tracking2D | StartupConfiguration.Features.Geo;
             * if you need both 2d Tracking and Geo
             */
            int requiredFeatures = ArchitectStartupConfiguration.Features.Tracking2D;
            MissingDeviceFeatures missingDeviceFeatures = ArchitectView.isDeviceSupported(this, requiredFeatures);


            if ((ArchitectView.getSupportedFeaturesForDevice(Android.App.Application.Context) & requiredFeatures) == requiredFeatures)
            {
                architectView.OnCreate(startupConfiguration);
                architectView.RegisterUrlListener(this);
            }
            else
            {
                architectView = null;
                Toast.MakeText(this, missingDeviceFeatures.getMissingFeatureMessage(), ToastLength.Long).Show();

                //StartActivity(typeof(ErrorActivity));
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.sample_cam);

            Title = Intent.GetStringExtra("id");

            //Create path to samples
            worldUrl = "SDK_Examples" + File.Separator + Intent.GetStringExtra("id") + File.Separator + "index.html";

            architectView = FindViewById <ArchitectView>(Resource.Id.architectView);

            ArchitectStartupConfiguration startupConfiguration = new ArchitectStartupConfiguration();

            startupConfiguration.setLicenseKey(Constants.WIKITUDE_SDK_KEY);
            startupConfiguration.setFeatures(ArchitectStartupConfiguration.Features.ImageTracking);
            startupConfiguration.setCameraResolution(CameraSettings.CameraResolution.Auto);


            int requiredFeatures = ArchitectStartupConfiguration.Features.ImageTracking;
            MissingDeviceFeatures missingDeviceFeatures = ArchitectView.isDeviceSupported(this, requiredFeatures);

            if ((ArchitectView.getSupportedFeaturesForDevice(Application.Context) & requiredFeatures) == requiredFeatures)
            {
                architectView.OnCreate(startupConfiguration);
                architectView.RegisterUrlListener(this);
            }
            else
            {
                architectView = null;
                Toast.MakeText(this, missingDeviceFeatures.getMissingFeatureMessage(), ToastLength.Long).Show();

                StartActivity(typeof(ErrorActivity));
            }
        }
Пример #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.cam);


            Title = "Scan the Image";



            // get the tracker id from the (Previous) scannerpage
            int result = int.Parse(Intent.GetStringExtra("target_ID"));

            // get the detail id from the (Previous) scannerPage
            detailID = int.Parse(Intent.GetStringExtra("detail_ID"));

            // Checks the tracker id. If its 1 - 4 it will like to the corresponding folder. Else if will load first AR object
            switch (result)
            {
            case 1:
                worldUrl = "Augmented/Barrel/index.html";
                break;

            case 2:
                worldUrl = "Augmented/Tree/index.html";
                break;

            case 3:
                worldUrl = "Augmented/FireRedTree/index.html";
                break;

            case 4:
                worldUrl = "Augmented/secondWoodenBarrel/index.html";
                break;

            default:
                worldUrl = "Augmented/Barrel/index.html";
                break;
            }

            // finds the view on the resource page and stores it in the corresponding variables.
            architectView = FindViewById <ArchitectView>(Resource.Id.architectView);
            detailButton  = FindViewById <ImageButton>(Resource.Id.detailButton);
            HomeButton    = FindViewById <ImageButton>(Resource.Id.HomeButton);

            // adds a button click handler to the buttons
            detailButton.Click += Detail_HandleClick;
            HomeButton.Click   += Home_HandleClick;


            // setting data for the architectview
            ArchitectStartupConfiguration startup = new ArchitectStartupConfiguration();

            // set the licensekey
            startup.setLicenseKey(TotallyNotAKeyClass.WIKITUDE_KEY);
            startup.setFeatures(ArchitectStartupConfiguration.Features.ImageTracking);
            startup.setCameraResolution(CameraSettings.CameraResolution.Auto);

            // features that are required
            int requiredFeatures = ArchitectStartupConfiguration.Features.ImageTracking;
            MissingDeviceFeatures missingDeviceFeatures = ArchitectView.isDeviceSupported(this, requiredFeatures);


            //checks if the required features defined above are located on the android device
            if ((ArchitectView.getSupportedFeaturesForDevice(Android.App.Application.Context) & requiredFeatures) == requiredFeatures)
            {
                architectView.OnCreate(startup);
                architectView.AddArchitectJavaScriptInterfaceListener(this);
            }
            else
            {
                architectView = null;
                Toast.MakeText(this, missingDeviceFeatures.getMissingFeatureMessage(), ToastLength.Long).Show();

                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetMessage("Something went wrong");
                //StartActivity(typeof(ErrorActivity));
            }

            // if the detailbutton is pressed it will redirect to the details.xaml page
        }