![]() Orientation (Landscape, Portrait, Square, Unknown) Var mainDisplayInfo = DeviceDisplay.MainDisplayInfo private void Button_Clicked(object sender, EventArgs e) The function requires an IRecognitionListener interface so we need to implement that interface in our activity class.You can use Xamarin.Essentials: Device Display Information to get the current orientation degree. In the block of code above we passed to the StartRecognition() method a pointer to our main activity class. The last parameter is a CloudRecognitionInfo object holding the names of cloud databases in which to search markers, it's useful only when using Global as RecognitionMode and will be explained in the next tutorial. The second parameter, of type RecognitionOptions.RecognitionMode indicates whether to use Continous scan/recognition of image markers or TapToScan mode (the latter requires user input to launch a new marker search). The RecognitionOptions object can be created on-the-fly using a 3-parameters constructor requiring a RecognitionOptions.RecognitionStorage option that indicates whether to use Local recognition mode or Global (cloud recognition + local markers) mode. The S tartRecognition() method requires as parameters a RecognitionOptions object and a reference to an object implementing a IRecognitionListener interface. ![]() ![]() String permissions_required = new string ) called m_permissionCode) and assign a unique integer value to it. The method receive a integer unique code to identify the request. The method uses Activit圜ompat.CheckSelfPermission to check if requested permission have been granted before, if not it uses Activit圜ompat.RequestPermissions to requests missing permissions. The following method will ask the user for Camera, WriteExternalStorage and ReadExternalStorage permissions. Now add a new method that will ask the user for permission. In order to support Android 6.0+ we have to slightly modify the MainActivity.cs code in order to ask the user for permissions about camera access and read/write access to the SD memory.Ĭreate a private method InitLayout() and move OnCreate's SetContentView there. The activity holding Pikkart's AR stuff must have set ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation and an AppCompat theme in the MainActivity.cs class declaration as in the following example: Also copy the sample markers and media dirs ( /Assets/markers/ and /Assets/media/) into your app project assets dir (you can download the sample package here).Īdd the following permissions in the Android Manifest tab in the project properties:Īnd in the Manifest.xml file add the following permissions: Then copy the license file we provided you inside your app assets dir (create the assets dir on the root of the solution folder if it doesn't exist). Select the Pikkart.ArSdk package and in the detail page click on Install.Īfter the package has been added you should see .Geo and .Recognition assemblies on the References menu. ![]() In the NuGet page type Pikkart.ArSdk in the search bar to find our sdk Now right click on the voice References of the project and click Manage NuGet Packages. Open the Properties menu and in the Android Manifest tab, if you have already purchased a license, set the Package name you provided when buying your Pikkart's AR license, otherwise use " " if you're using the trial license provided by default when you register as a developer. Now it's time to set-up your app for development with Pikkart's AR SDK. When the project is ready close the GettinStarted.Xamarin page and open the MainActivity that xamarin had created. Write your App name and choose project location in the Create New Project Wizard and click Ok. Note: if you prefer to read existing and working code, a complete Visual Studio project can be found on Github (remember to add you license file in the assets folder!).įirst create a new application in Visual Studio using the Blank App (Android) template Our SDK is designed for use with Visual Studio (versions 2015+), and supports Android SDK level 15+ (21+ for the 64 bit version). This tutorial will guide you through the creation of a simple AR application that detects and tracks an image marker stored in the app assets and draws a simple 3D model on it.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |