native

Extending Smartface with Native iOS and Android Plugins

Smartface plugin interface is now open to all users, including the free Community license. Everyone can create their own native Objective-C and Java plugins for Smartface App Studio. The possibilities to extend your Smartface apps are now endless.

Smartface is a JavaScript based cross-platform native framework and it already provides a JavaScript interface to native OS components in iOS and Android. However, there might cases where you need to use a specific SDK for a specific purpose or a custom component.

Some of the examples for such cases are:

  • SDKs for different enterprise systems and frameworks for security, connectivity, etc.
  • SDKs for cloud services (you can use any cloud service with Smartface)
  • SDKs for mobile services such as analytics, in-app communication, application health monitoring, etc.
  • Custom user interface components such as animations or buttons and menus with different designs and interaction options or gesture components
  • Supporting beacons on Android (iBeacon is already supported in Smartface) or using a third party beacon framework

 

Plugin is a broad term and its definition tends to change in each platform, where they might be named as addons, extensions or components in different platforms. In Smartface, we have elected to define native plugins as any kind of native code/functionality that is implemented in Smartface with the plugin interface.

With native plugin support in Smartface, you can even implement full apps developed in Objective-C or Java.

In the lifecycle of a plugin in Smartface, there are two different phases involved.

If you are a Smartface developer who just wants to use a third party plugin, the development and packaging steps are not important for you. You may skip to the “Using the plugin” section to use any plugin just in two steps.

 

1. Native plugin development and packaging

The development and packaging are specific to each native platform and require some familiarity with the native development tools.

i. Developing iOS plugins with Objective-C:
  • Create the plugin template with the CLI tool
  • Merge your native code with the template
  • Fill in the configuration file
  • Define classes to be used in JavaScript
  • From the project files, generate the plugin file using the CLI tool

You can distribute the generated zip file, the Smartface plugin, in any way you like. For technical details on iOS plugins, you can refer to the Developing iOS (Objective-C) Plugins for Smartface guide and for a step-by-step generation of an iOS plugin, you can refer to the Hello World with iOS Plugin guide.

 

ii. Developing Android plugins with Java:
  • Download the plugin template from Smartface website
  • Put the template under Java folder in your project in the Android development environment
  • Fill in the configuration file
  • Define classes to be used in JavaScript
  • Generate the plugin file using the CLI tool
  • Build the project apk
  • From the apk, generate the plugin file using the CLI tool

You can distribute the generated zip file, the Smartface plugin, in any way you like. For technical details on Android plugins, you can refer to the Developing Android (Java) Plugins for Smartface guide and for a step-by-step generation of an Android plugin, you can refer to the Hello World with Android Plugin guide.

 

 2. Using the plugin in Smartface (JavaScript development)

It is very easy to implement any native plugin in Smartface just in two steps.

  • Get the plugin file from the developer and put it inside the Data->Plugins folder in your project structure
  • Activate the plugin in Project Details->Plugins section in Smartface IDE

You may refer to the Smartface Plugin guide for technical information.

 

Also, please note that with this plugin update, there are changes in the implementations of the third party plugins already available in Smartface. Now, they are presented as third party plugins as well.

You may refer to the guides section for more information about the changed components and you can visit the Smartface Developer Center for more native iOS and Android development resources. For updates, you can follow us on Twitter @smartface_io

With plugins, you can utilize any iOS and Android native code, component and SDK in Smartface to develop native apps just with JavaScript.

Download Smartface now and start native iOS and Android development!