Пример #1
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			if (ArchitectView.IsDeviceSupported (AugmentedRealityMode.Geo))
			{
				arView = new ArchitectView (UIScreen.MainScreen.Bounds);
				View = arView;
			
				arView.SetLicenseKey ("YOUR-LICENSE-KEY");

				var absoluteWorldUrl = WorldOrUrl;

				if (!IsUrl)
					absoluteWorldUrl = NSBundle.MainBundle.BundleUrl.AbsoluteString + "ARchitectExamples/" + WorldOrUrl + "/index.html";

				var u = new NSUrl (absoluteWorldUrl);
				
				arView.LoadArchitectWorld (u);

			}
			else
			{
				var adErr = new UIAlertView ("Unsupported Device", "This device is not capable of running ARchitect Worlds. Requirements are: iOS 5 or higher, iPhone 3GS or higher, iPad 2 or higher. Note: iPod Touch 4th and 5th generation are only supported in WTARMode_IR.", null, "OK", null);
				adErr.Show ();
			}
		}
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (ArchitectView.IsDeviceSupported(AugmentedRealityMode.Geo))
            {
                arView = new ArchitectView(UIScreen.MainScreen.Bounds);
                View   = arView;

                arView.SetLicenseKey("YOUR-LICENSE-KEY");

                var absoluteWorldUrl = WorldOrUrl;

                if (!IsUrl)
                {
                    absoluteWorldUrl = NSBundle.MainBundle.BundleUrl.AbsoluteString + "ARchitectExamples/" + WorldOrUrl + "/index.html";
                }

                var u = new NSUrl(absoluteWorldUrl);

                arView.LoadArchitectWorld(u);
            }
            else
            {
                var adErr = new UIAlertView("Unsupported Device", "This device is not capable of running ARchitect Worlds. Requirements are: iOS 5 or higher, iPhone 3GS or higher, iPad 2 or higher. Note: iPod Touch 4th and 5th generation are only supported in WTARMode_IR.", null, "OK", null);
                adErr.Show();
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            WebView.SetWebContentsDebuggingEnabled(true);

            architectView = new ArchitectView(Context);
            return(architectView);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            this.VolumeControlStream = Android.Media.Stream.Music;

            SetContentView(Resource.Layout.sample_cam);

            var title = "Test World";

            if (Intent.Extras != null && Intent.Extras.Get(EXTRAS_KEY_ACTIVITY_TITLE_STRING) != null)
            {
                title = Intent.Extras.GetString(EXTRAS_KEY_ACTIVITY_TITLE_STRING);
            }

            Title = title;

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

            //TODO: SDK KEY
            var config = new ArchitectView.ArchitectConfig(Constants.WIKITUDE_SDK_KEY);

            architectView.OnCreate(config);

            this.architectView.RegisterSensorAccuracyChangeListener(this);

            this.locationProvider = new LocationProvider(this, this);
        }
        private static int FilterUnsupportedArExperiences(Context context, List <ArExperienceGroup> experienceGroups)
        {
            int removedExperiences = 0;

            foreach (var group in experienceGroups)
            {
                removedExperiences += group.ArExperiences.RemoveAll(experience => !ArchitectView.IsDeviceSupporting(context, GetEnumSetFeatures(experience.FeaturesMask)).IsSuccess);
            }
            experienceGroups.RemoveAll(group => group.ArExperiences.Count == 0);
            return(removedExperiences);
        }
        private static int FilterUnsupportedArExperiences(Context context, List <ArExperienceGroup> experienceGroups)
        {
            Features supportedFeaturesForDevice = (Features)ArchitectView.GetSupportedFeaturesForDevice(context);

            int removedExperiences = 0;

            foreach (var group in experienceGroups)
            {
                removedExperiences += group.ArExperiences.RemoveAll(experience => (experience.FeaturesMask & supportedFeaturesForDevice) != experience.FeaturesMask);
            }
            experienceGroups.RemoveAll(group => group.ArExperiences.Count == 0);
            return(removedExperiences);
        }
Пример #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            deleteDirectoryContent(ArchitectView.GetCacheDirectoryAbsoluteFilePath(this));

            var values = getListLabels();

            this.ListAdapter = new ArrayAdapter <string> (this, Android.Resource.Layout.SimpleListItem1, Android.Resource.Id.Text1, values);

            var buttonLaunchUrl = FindViewById <Button> (Resource.Id.buttonLaunchUrl);

            buttonLaunchUrl.Click += (sender, e) => StartActivity(typeof(ARchitectUrlLauncherActivity));
        }
Пример #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.cam);

            var title = "Exhibit ID:";

            Title = title + Intent.GetStringExtra("id");

            world = "wikitude" + File.Separator + Intent.GetStringExtra("id") + File.Separator + "index.html";

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

            var config = new ArchitectView.ArchitectConfig(AppSettings.WikitudeSDKkeyAndroid);

            architectView.OnCreate(config);

            this.architectView.RegisterSensorAccuracyChangeListener(this);
            this.locationProvider = new LocationProvider(this, this);
        }
Пример #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView(Resource.Layout.sample_cam);

            Title = TITLE;

            architectView = FindViewById<ArchitectView>(Resource.Id.architectView);
            var config = new StartupConfiguration (Constants.WIKITUDE_SDK_KEY, StartupConfiguration.Features.Tracking2D);
            /* use
               int requiredFeatures = StartupConfiguration.Features.Tracking2D | StartupConfiguration.Features.Geo;
               if you need both 2d Tracking and Geo
            */
            int requiredFeatures = StartupConfiguration.Features.Tracking2D | StartupConfiguration.Features.Geo;
            if ((ArchitectView.getSupportedFeaturesForDevice (Android.App.Application.Context) & requiredFeatures) == requiredFeatures) {
                architectView.OnCreate (config);
            } else {
                architectView = null;
                StartActivity (typeof(ErrorActivity));
            }
        }
Пример #10
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));
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            this.VolumeControlStream = Android.Media.Stream.Music;

            SetContentView(Resource.Layout.sample_cam);

            var title = "Test World";

            if (Intent.Extras != null && Intent.Extras.Get (EXTRAS_KEY_ACTIVITY_TITLE_STRING) != null)
                title = Intent.Extras.GetString (EXTRAS_KEY_ACTIVITY_TITLE_STRING);

            Title = title;

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

            //TODO: SDK KEY
            var config = new ArchitectView.ArchitectConfig (Constants.WIKITUDE_SDK_KEY);

            architectView.OnCreate (config);

            this.architectView.RegisterSensorAccuracyChangeListener (this);

            this.locationProvider = new LocationProvider (this, this);
        }
Пример #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            /*
             * Used to enabled remote debugging of the ArExperience with
             * google chrome https://developers.google.com/web/tools/chrome-devtools/remote-debugging
             */
            WebView.SetWebContentsDebuggingEnabled(true);


            if (!Intent.HasExtra(IntentExtrasKeyExperienceData))
            {
                var message = GetString(Resource.String.error_loading_ar_experience_invalid_intent, Class.SimpleName, IntentExtrasKeyExperienceData);
                throw new System.Exception(message);
            }

            /*
             * The following code is used to run different configurations of the SimpleArActivity.
             * It is not required to use the ArchitectView but is used to simplify the example app.
             *
             * Because of this the Activity has to be startet with correct intent extras.
             * e.g.:
             * var experience = new ArExperience(
             *      "ExperienceName",
             *      "ExperiencePath",
             *      Features.ImageTracking | Features.Geo,
             *      CameraPosition.Back,
             *      CameraResolution.Auto,
             *      CameraFocusMode.Continuous,
             *      camera2Enabled: true
             * );
             *
             * var intent = new Intent(this, typeof(SimpleArActivity));
             * intent.PutExtra(SimpleArActivity.IntentExtrasKeyExperienceData, ArExperience.Serialize(lastExperience));
             * StartActivity(intent);
             */
            var experience = ArExperience.Deserialize(Intent.GetByteArrayExtra(IntentExtrasKeyExperienceData));

            arExperiencePath = experience.Path;

            /*
             * The ArchitectStartupConfiguration is a required parameter for architectView.OnCreate.
             * It controls the startup of the ArchitectView which includes camera settings,
             * the required device features to run the ArchitectView and the LicenseKey which
             * has to be set to enable an AR-Experience.
             */
            var config = new ArchitectStartupConfiguration                                                                // Creates a config with its default values.
            {
                LicenseKey       = GetString(Resource.String.wikitude_license_key),                                       // Has to be set, to get a trial license key visit http://www.wikitude.com/developer/licenses.
                CameraPosition   = Util.PlatformConverter.ConvertSharedToPlatformPosition(experience.CameraPosition),     // The default camera is the first camera available for the system.
                CameraResolution = Util.PlatformConverter.ConvertSharedToPlatformResolution(experience.CameraResolution), // The default resolution is 640x480.
                CameraFocusMode  = Util.PlatformConverter.ConvertSharedToPlatformFocusMode(experience.CameraFocusMode),   // The default focus mode is continuous auto focus.
                Camera2Enabled   = experience.Camera2Enabled,                                                             // The camera2 api is enabled by default on devices that support it.
                ArFeatures       = (int)experience.FeaturesMask                                                           // This tells the ArchitectView which AR-features it is going to use, the default is all of them.
            };

            architectView = new ArchitectView(this);
            architectView.OnCreate(config); // Mandatory ArchitectView lifecycle call

            SetContentView(architectView);  // Adds the architectView to the activity.

            // Prevent device from sleeping
            Window.AddFlags(flags: WindowManagerFlags.KeepScreenOn);
        }
Пример #14
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
        }