Preview 2.0 is now in Public Beta!
Read the Announcement
Note: You are on the beta version of our docs. This is a work in progress and may contain broken links and pages.

NativeScript allows you to access any native APIs anytime in your app. If the native API you need is not exposed through @nativescript/core or third party plugins or @nativescript/* plugins), you can add it to your project and access it right away in TypeScript.

  1. Add native code to App_Resources. For example, see Adding Java/Kotlin code to an application and Adding ObjectiveC/Swift Code to an application

  2. Generate types for the added APIs For iOS types run:

cli
ns typings ios

For Android run:

cli
ns typings android --jar <.jar path>
  1. Reference the generated types in references.d.ts

  2. You can now code (strongly typed) against the platform native APIs. For various examples on how to interact with native API's in JavaScript/TypeScript, visit the Subclassing, iOS Marshalling and Android Marshalling pages

Additional Resources