Advanced Concepts
Adding custom native code to a project
NativeScript allows you to access any native API anytime in your app.
If the native API you need is not exposed through @nativescript/core, third party plugins or @nativescript/* plugins), you can add it to your project and access it right away in TypeScript.
Add native code to App_Resources. For example, see
Generate types for the added APIs For iOS types run:
clins typings ios
For Android run:
clins typings android --jar <path to a jar> # or ns typings android --aar <path to an aar>
Reference the generated types in references.d.ts
You can now code against the platform native APIs (strongly typed). For various examples on how to interact with native APIs in JavaScript/TypeScript, visit the Subclassing, iOS Marshalling and Android Marshalling pages.
Additional Resources
- Android d.ts Generator, for advanced types generation for Android
- Previous
- Styling