Imagine you are working in Android and importing a method using import info.card.getCardsInfo
, then calling it to retrieve some data like
Cards[] cards=getCardsInfo()
In the scenario above, after importing an `aar` file into a NativeScript project, you would need to use the following code to access the card data.
declare var info:any
export class CardService{
public getCard(){
let cards=info.card.getCardsInfo;
return cards;
}
}
In NativeScript, you can directly access any Android native packages from anywhere within your code using com.package.app.method
.
However, to avoid errors from the TS compiler, you must declare the `com` variable as `any` like this declare var com:any
or let com:any
in your TypeScript file before accessing native APIs.
For more information on this topic, visit