Development guidelines for using native API
Native applications need native API content, which depends on the development environment. You start from a MobileFirst project, add a second project, and define the native application from the native API application. To build and deploy the native application, you create a .wlapp file and upload it to the console.
Options to create MobileFirst applications
As for other types of mobile applications, you start the development of the native app in MobileFirst Studio by creating a MobileFirst application. To develop a native application, we must create a MobileFirst application of type Native API. Your native application requires the content of such a Native API application to use the corresponding MobileFirst native API. This content depends on the selected mobile environments.
- For iOS, the MobileFirst Objective-C client-side API. Specific steps apply if we use Apple Swift, a language that is compatible with Objective-C. See Develop native applications for iOS.
- For Android, the MobileFirst Java client-side API.
- For the Enterprise Edition (Java EE) , Micro Edition (Java ME), the MobileFirst Java client-side API.
- For Windows Phone 8, the MobileFirst C# client-side API.
- For Windows 8, the MobileFirst C# client-side API.
The process to create a native API application differs depending on whether the project.exists or not.
- If we already have a MobileFirst project, create and add the native API application to it. You work in MobileFirst Studio.
- Click File > New > MobileFirst Native API.
- Select the existing project.
- Set the application name.
- To specify the environment, select Android, iOS, Java ME, WindowsPhone8, or Windows 8.
- Click Finish.
- If we do not have a MobileFirst project, you create a MobileFirst project of type native API in MobileFirst Studio. Then you create a native API application as its first application.
- Click File > New > MobileFirst Project, and then select the Native API template.
- Set the application name.
- To specify the environment, select Android, iOS, Java ME, WindowsPhone8, or Windows 8.
- Click Finish.
For more information on calling adapter procedures from native iOS applications, see the tutorials on the Get Started page.
Application files
In both cases, you create the native API application in MobileFirst Studio. Such applications contain the following files:
- The application descriptor file: This file is application-descriptor.xml in the application root directory.
- The MobileFirst native library and the client property file: Their name and format depend on the environment.
- iOS
- The WorklightAPI folder defines the MobileFirst native library.
- The worklight.plist file is the client property file.
- Android
- The worklight-android.jar file defines the MobileFirst native library.
- The wlclient.properties file is the client property file.
- Java ME
- The worklight-javame.jar file and the json4javame.jar file together define the MobileFirst native library.
- The wlclient.properties file is the client property file.
- Windows Phone 8
- The worklight-windowsphone8.dll file defines the MobileFirst native library. The Newtonsoft.Json.dll library is required for using JSON objects in C#.
- The wlclient.properties file is the client property file.
- Windows 8
- The worklight-windows8.dll file defines the MobileFirst native library. The Newtonsoft.Json.dll is a library that is required for using JSON objects in C#.
- The wlclient.properties file is the client property file.
Complementary project for native applications
Unlike hybrid applications, which develop entirely within MobileFirst Studio, native applications need a second project, which you create in a different IDE. For example:
- For iOS, a project in the Xcode IDE to develop a native application with Objective-C or Swift. If we choose to write in Swift, follow the Swift-specific steps described in Table 2: Hello Worklight of Tutorials, samples, and additional resources.
- For Android or Java ME, a project in the Eclipse IDE to develop a native application with Java.
- For Windows Phone 8, a project in Visual Studio Express for Windows Phone or Visual Studio 2012 Professional or higher.
- For Windows 8, a project in Visual Studio Express for Windows 8 or in Visual Studio 2012 Professional or higher.
Creation of the native application from the native API application
After the native API application is created, create the native application as follows:
- Define the various aspects of the application by setting the appropriate values in the application descriptor file.
- Update the client property file as necessary.
- Copy the client property file and the native library to the appropriate location of the native project. We must also create references from your native app project to this content to use the MobileFirst native API.
- iOS
- To update the application descriptor file, see Application descriptor of native API applications for iOS.
- To update the client property file, see Client property file for iOS.
- To copy the client property file and the native library into the appropriate location of the native project, and create appropriate references, see Copy files of native API applications for iOS.
- Android
- To update the application descriptor file, see Application Descriptor of Native API application for Android.
- To update the client property file, see Client property file for Android.
- To copy the client property file and the native library into the appropriate location of the native project, and create appropriate references, see Copy files of Native API applications for Android.
- Java ME
- To update the application descriptor file, see Application descriptor of native API applications for Enterprise Edition (Java EE) , Micro Edition (Java ME).
- To update the client property file, see Client property file for Enterprise Edition (Java EE) , Micro Edition (Java ME).
- To copy the client property file and the native library into the appropriate location of the native project, and create appropriate references, see Copy files of Native API applications for Enterprise Edition (Java EE) , Micro Edition (Java ME).
- Windows Phone
- To update the application descriptor file, see Application descriptor of native C# API application for Windows Phone 8.
- To update the client property file, see Client property file for Windows Phone 8.
- To copy the client property file and the native library into the appropriate location of the native project, and create appropriate references, see Copy files of Native API applications for Windows Phone 8.
- Windows 8
- To update the application descriptor file, see Application Descriptor of native C# API application for Windows 8.
- To update the client property file, see Client property file for Windows 8.
- To copy the client property file and the native library into the appropriate location of the native project, and create appropriate references, see Copy files of native API applications for Windows 8.
Build and deployment
You build and deploy native API applications by following the same procedure as for hybrid applications. We create the .wlapp file and upload it to the operations console. For more information about deployment, see Deploy applications and adapters to MobileFirst Server.
Parent topic: Develop native applications