Exemple #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);
        }
Exemple #2
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));
            }
        }
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            var experience = ArExperience.Deserialize(Arguments.GetByteArray(IntentExtrasKeyExperienceData));

            var arExperiencePath = experience.Path;

            var config = new ArchitectStartupConfiguration
            {
                LicenseKey       = GetString(Resource.String.wikitude_license_key),
                CameraPosition   = Util.PlatformConverter.ConvertSharedToPlatformPosition(experience.CameraPosition),
                CameraResolution = Util.PlatformConverter.ConvertSharedToPlatformResolution(experience.CameraResolution),
                CameraFocusMode  = Util.PlatformConverter.ConvertSharedToPlatformFocusMode(experience.CameraFocusMode),
                Camera2Enabled   = experience.Camera2Enabled,
                ArFeatures       = (int)experience.FeaturesMask
            };

            architectView.OnCreate(config);
            architectView.OnPostCreate();

            architectView.Load(arExperiencePath);
        }
        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));
            }
        }
Exemple #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // ToDo:
            // ユーザ認証を行い、以下のケースはログイン画面に戻す(Activity遷移)。正常に認証された場合は続行
            // 1. ユーザが存在しない
            // 2. 最後に起動してから一定期間経過(セッション:2~3[weeks])
            // 3. トークン, トークンシークレットが一致しない -> 不正アクセスされた恐れがあるので本人確認


            SetContentView(Resource.Layout.Main);
            context = this;

            // Mパーミッション設定
            {
                var permission       = CheckSelfPermission(Manifest.Permission.AccessFineLocation);
                var cameraPermission = CheckSelfPermission(Manifest.Permission.Camera);

                /*if(permission != Android.Content.PM.Permission.Granted ||
                 * cameraPermission != Permission.Granted) {
                 *      if(ShouldShowRequestPermissionRationale(Manifest.Permission.AccessFineLocation) ||
                 *         ShouldShowRequestPermissionRationale(Manifest.Permission.Camera) ||
                 *         ShouldShowRequestPermissionRationale(Manifest.Permission.Internet)){
                 *
                 *      }
                 *
                 *      ActivityCompat.RequestPermissions(this,
                 *                                        new string[] { Manifest.Permission.AccessFineLocation,
                 *              Manifest.Permission.Camera,
                 *              Manifest.Permission.Internet},
                 *                                      1);
                 * } else*/{
                    using (var locationCriteria = new Criteria()) {
                        locationManager                   = (LocationManager)GetSystemService(LocationService);
                        locationCriteria.Accuracy         = Accuracy.Fine;
                        locationCriteria.PowerRequirement = Power.NoRequirement;

                        locationProvider = locationManager.GetBestProvider(locationCriteria, true);
                    }
                    locationManager.RequestLocationUpdates(locationProvider, 1500, 1, this);
                }


                if (cameraPermission == Permission.Granted)
                {
                    var config = new ArchitectStartupConfiguration {
                        LicenseKey       = "RZXUaNt3EqX/INY0REirYMQ4e73tOYpsoFywmJTrg6HWPdp7V/7e27rqIJBpT9Ni5CAu115KhWsY4IzVRXhzUw+9k9sLujt/OUcfLlOJJ0UymQystslk8VqfqaiIHf1+VtI7aK3SqAGlDYFLrWXgAWMXiW4DqqK7dqoOQ5kN6OBTYWx0ZWRfXyWhW0AGb4tTioEED84Fzr//uWdd5t8dzpPtYnJNIXKyOVICVkXDJRwfpJHtx4N0zIX43T5GB+FiMbU92xZurSK7OUiOcY2E35oqo9KGpnxL3syXdT2/03qxZ71/tQ8Yl3qautVzxVq/vu1ruXp/Utt9Nm5GNKKqjetm+pDRQe4URtmPuKgvKVy3dBmtBqceKZM/sVidHwps7m+DyWOtABv9Mz9u2NwifjtJiUiYC3oJMrnFUHS+9LuqNEo6phf6joXOdlYCMXCCTJiHPiyUKoTIF6rc3WVOIJ72seQpcvoZrIBtO4kd9GbjAMRaYeOeSfaFf+fAFhhbqIrjQGgCP50KVtt70bpCVdf4ADZXYrimKUMcUezL/QoA+FACDA+KVXJrGZHpmpbdmo+7WhUTnhe8hCUglg+fSp8cNbLmNoA+BXPp3o8p6VBDuTMgukNORJRAFtiUws62dhgu7RrKeHV0PBw0gXNJ92COVASrP/T478qMjk0XpxxepeRaTSq+rBSBv9OL48YE0SkV856UQ+9inVkf8ec54Q==",
                        CameraPosition   = CameraSettings.CameraPosition.Back,
                        CameraResolution = CameraSettings.CameraResolution.FULLHD1920x1080,
                        CameraFocusMode  = CameraSettings.CameraFocusMode.Continuous,
                        ArFeatures       = ArchitectStartupConfiguration.Features.Geo,
                        Camera2Enabled   = true
                    };

                    AroundFragment.architectView = new ArchitectView(this);
                    AroundFragment.architectView.OnCreate(config);
                }
            }

            // tab設定
            using (var tablayout = FindViewById <TabLayout>(Resource.Id.tab_layout)){
                using (var viewPager = FindViewById <ViewPager>(Resource.Id.view_pager)) {
                    viewPager.Adapter = new FragmentAdapter(SupportFragmentManager, ApplicationContext);
                    tablayout.SetupWithViewPager(viewPager);
                }
                tablayout.GetTabAt(2).Select();
            }
        }
Exemple #6
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
        }