Provides nativescript access to Wikitude AR.
Versioning is as follows ${wikitude-version}-${plugin-version}example : 7.2.1-1.1.0
is Wikitude Version 7.2.1, Plugin version 1.1.0.
Core | Angular | Vue |
---|---|---|
before you can use this plugin you should ensure your application has permissions for Camera and Location, for an easy way to do this on both android and ios, you can make use of this plugin @spartadigital/nativescript-permissions
WE include a very basic AR Sample in the Demo app,
but if you want to check something a bit more advanced from wikitude examples and place them in demo/app/wikitude
... Then update the URL Reference in either the items.component.ts
for Nativescript-angular or the main-view-model.ts
in Regular Nativescript.
and then go and grab a Trial License from Wikitude's Website and place it in demo/app/main-view-model.ts
on line 13
to install for your project you can use :
tns plugin add nativescript-wikitude
for Nativescript Angular Projects you will need to import the Element in your app.component.ts
import { Wikitude } from 'nativescript-wikitude';
// ...snip....
registerElement('Wikitude', () => Wikitude);
and then in your ar.component.html
:
<Wikitude [url]="WikitudeURL"
(WorldLoaded)="onWorldLoaded($event)"
(JSONReceived)="onJSON($event)">
</Wikitude>
and in your ar.component.ts
:
import { Wikitude } from 'nativescript-wikitude';
// ...snip...
WikitudeInstance: Wikitude;
WikitudeURL: string = "~/wikitude_world/index.html";
onWorldLoaded($event) {
this.WikitudeInstance = $event.owner; // or you can use Angular's ViewChild
}
onJSON($event) {
console.log(JSON.stringify($event.data));
}
// ...snip...
and somewhere in your application you will need to define the wikitude license, you can get one from wikitude (free trial license)
(global as any).wikitudeLicense: string = "YOUR_LICENSE_KEY_HERE"
And Voila! you have Wikitude AR working in your Nativescript Application!
by default this plugin has a basic Location Provider, if this does not suit your purpose, you can disable it once it is fully loaded, with the following code :
onWorldLoaded($event) {
this.WikitudeInstance = $event.owner; // or you can use Angular's ViewChild
this.WikitudeInstance.disableLocationProvider();
}
Once Disabled, Geo-location based AR will not work unless you provide your own location, this can be achieved with the following
this.WikitudeInstance.setLocation({ latitude, longitude, altitude, accuracy });
this is useful if you want a single location state.
once you have disabled it you can re-enable it with the following :
this.WikitudeInstance.enableLocationProvider();
Property | Default value | Description |
---|---|---|
url | "" |
the URL of the Wikitude "ARWorld" |
features | ` Features.ImageTracking | Features.InstantTracking |
Function | Arguments | Description |
---|---|---|
setLocation() | { latitude: number, longitude: number, altitude: number, accuracy: number } |
sets the location in the ARWorld |
hasFeature() | feature : number |
checks if your device can support said features (or if your license supports it) |
loadUrl() | url: string |
loads the URL in the Wikitude WebView |
reload() | reloads the current Wikitude WebView | |
clearCache() | clears the wikitude Cache | |
toggleFlash() | Toggles the Devices Flash-light | |
switchCamera() | switches the Camera that wikitude uses | |
captureScreen() | captureWebViewContent: boolean |
captures the current view, can also capture the webview content |
disableLocationProvider() | disables the location Provider (you will need to provide your own for GEO/POI's to work) | |
enableLocationProvider() | enables the location Provider |
Event | Description | Type |
---|---|---|
WorldLoadSuccess | Fires when the ARWorld Loads Successfully | WorldLoadSuccessEventData |
WorldLoadFail | Fires if an Error Occurs while loading the AR World | WorldLoadFailedEventData |
JSONReceived | Fires when the ARWorld sends a JSON Object | JSONReceivedEventData |
ScreenCaptureSuccess | fires when the screen is captured | ScreenCaptureSuccessEventData |
ScreenCaptureFail | fires when wikitude fails to capture the screen | ScreenCaptureFailedEventData |
all can be imported from the index.d.ts.
Wikitude is (c) Wikitude GmbH Before using see their End-User License Agreement
Apache License Version 2.0, January 2004
NativeScript 可以使用 Javascript,CSS, XML 创建真正的 Native 跨平台应用,支持 iOS Android,NativeScript 将您的跨平台代码翻译成目标平台的代码。 UI 使用 XML 描述,CSS 样式,在编译时将 UI 转化成本地原生代码,最终得到正在的 Native 原生应用。 Telerik 公开了用于创建安卓、iOS和Windows Unive
NativeScript Command-Line Interface The NativeScript CLI lets you create, build, and deploy NativeScript-based apps on iOS and Android devices. Get it using: npm install -g nativescript What is Native
NativeScript-Snackbar �� �� �� NativeScript plugin for Material Design SnackBar component. Installation: NativeScript 7+:tns plugin add @nstudio/nativescript-snackbar NativeScript version prior to 7:t
Nativescript-Ripple This plugin aims to bring a native (or close to native) ripple implementation on Android and iOS. The android version uses a RippleDrawable and conserves the previous background, a
NativeScript-FloatingActionButton NativeScript plugin for Material Design Floating Action Button UI component. Installation Nativescript 7+: ns plugin add @nstudio/nativescript-floatingactionbutton Na
NativeScript CardView A NativeScript plugin to provide an XML widget to implement the Material Design CardView component. Installation NativeScript 7+: ns plugin add @nstudio/nativescript-cardview Nat
This project has moved: This project is now being maintained here: https://github.com/nativescript-community/ui-mapboxas it's become clear contrary to what I thought, I don't actually have enough time
Nativescript Hijri plugin This plugin is inspired by https://github.com/arabiaweather/hijri-date Nativescript-hijri Hijri plugin allow you to convert gregorian date to islamic hijri date. Installation