Join Sahil Malik for an in-depth discussion in this video Why use plugins?, part of Developing Cordova Apps with Visual Studio Code and Typescript.
- [Instructor] Next let's talk about interacting with Native using plugins. What do we mean by Native? Your typical Native applications will need to interact with a lot of capabilities on mobile devices. Remember, this is the first reason we are writing the app itself. Things like GPS, geolocation, camera, accelerometer, contacts, audio, video, push notifications, a lot of such capabilities, and as devices expand, you'll see probably more such capabilities added to the devices.
Or you can use some other browser-specific implementations, but then you're not cross-platform enough. Camera, well, lately these new mobile devices have many megapixels in each picture, and the browser will simply go out of memory and the operating system will cause the browser to crash. Have you ever used an app on your iPhone, and it suddenly launches you back to the icon screen, which is called a springboard. Well the app crashed, typically what iOS devices will do is that if your app consumes too much memory, let's say you just took a picture using an HTML5 API, it'll simply cause your app to crash, springboard will kill your app, and many other such examples.
There is a rich library of these plugins. And if your app wishes to use a plugin on multiple platforms then the plugin includes the platform-specific code. iOS code typically written in Swift or Objective C, Windows C#, Android Java, and so on so forth. You could write plugins yourself as well, but then you'll be writing C#, Java, and Swift code. Luckily for us, there are lots of plugins available that other third parties have already written for us.
- Setting up your environment
- Adding the browser platform
- Adding and debugging the Android and iOS platforms
- Interacting with Native using plugins
- Why use plugins?
- Using TypeScript with Cordova
- Converting your code to TypeScript