Recently, I decided to delve into learning Nativescript. My goal is to create a simple ng2 app that utilizes a third-party Java library, similar to the example provided in this link:
However, I am encountering undefined errors along the way.
While I have no trouble accessing Java within my TypeScript code:
import app = require("application");
import platform = require("platform");
declare var java;
.......
public get message(): string {
var str = new java.lang.String('Hello world!');
var result = str.endsWith('world!');
console.log(result); // true
I seem to struggle with accessing the third-party Java library:
import {Component} from "@angular/core";
import app = require("application");
declare var KontaktSDK;
@Component({
selector: "my-app",
templateUrl: "app.component.html",
})
export class AppComponent {
public counter: number = 16;
public onTap(args) {
KontaktSDK.initialize("API_KEY");
this.counter--;
}
}
An error is thrown stating "ReferenceError: KontaktSDK is not defined".
I would greatly appreciate any assistance you can provide!