コード例 #1
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            var arExperiencePath = "ARPages/ARPage/index.html";

            var config = new ArchitectStartupConfiguration
            {
                LicenseKey       = Utils.Keys.WikitudeLicense,
                CameraPosition   = CameraSettings.CameraPosition.Back,
                CameraResolution = CameraSettings.CameraResolution.FULLHD1920x1080,
                CameraFocusMode  = CameraSettings.CameraFocusMode.Continuous,
                ArFeatures       = ArchitectStartupConfiguration.Features.ImageTracking | ArchitectStartupConfiguration.Features.Geo
            };

            architectView.OnCreate(config);
            architectView.OnPostCreate();
            architectView.Load(arExperiencePath);
            architectView.AddArchitectJavaScriptInterfaceListener(this);
        }
コード例 #2
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
        }