Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

How to port an app using Multi-OS Engine, a feature of Intel® INDE

$
0
0

Overview

Do you have an existing Android* app? Thinking of porting it to iOS* platforms as well? But you have no iOS development experience. Well, you don’t need to! Multi-OS Engine will address your problem. Please refer to this if you are not already familiar with Multi-OS Engine. To get a technical overview of Multi-OS Engine, please refer this article.

Multi-OS Engine SDK provides the below resources for app development from IDE integration to application deployment.

This article will provide you details on how to port an existing android apps to iOS using the Multi-OS Engine. In this tutorial we will be using a local MAC machine for application development. For remote development, please refer to the remote build getting started guide.

The process for porting an existing android app to Multi-OS Engine can be broken into a step by step process.

Let us start by creating a project in Android Studio. Please refer to the quick start guide for local build on instructions on creating and Android Project and Multi-OS Engine module

Assuming that the project and the Multi-OS Engine module have been created, we will go through each step briefly with code snippets for better understanding.

Identify business logic and separate the UI

With the Multi-OS Engine you can reuse java code to create Android and iOS apps. The Multi-OS Engine allows you to code in Java with common business functionality which can be shared between Android and iOS.

Design of UI using Multi-OS Engine

Next, design your iOS UI using one of the two ways mentioned below:

1. Xcode storyboard designer

· To use Xcode designer, you can open your module in the Xcode. Right click on your Multi-OS Engine module, and open project in Xcode.

· The module opens up in Xcode. Click on storyboard under the resources folder.

· Once, your UI design is ready, you can copy the storyboard to your project under resources folder in Android Studio.

2. Multi-OS Engine Designer

· The designer is similar to Android. The format of designer is ixml file. More information of using Multi-OS Engine can be found here.

Bind UI in Java

Open your controller class under <modulename> --> java --> <package_name> --> ui --> AppViewController. In this class, you can associate the bindings to the Xcode UI Layout.

· Add class variables to all the views used in your design in your controller file.

· Once the class variables are added, associate the getters and setters for IBActions or IBoutlets (Please note this step is only needed if you are using Xcode designer to design your interface). However, the @Property annotation is only for people who do NOT use Xcode designer. If people use Xcode designer and have native stubs they should NOT use @Property annotation.

Event Handling

If you have an event handling associated with any component, you can create instances of the event based classes that need to be assigned an action in order to respond to some event.

Implementation of business logic

We then create a separate module for the business logic which will be in java.

· To create the module, right click on your project in the Project Explorer and create a new module. Choose the New module as “Java Library”.

· Once the module is created, it has to be accessed by both the Android module and iOS module. For this, right click on the project, open module settings and add dependencies for the iOS module and the android module.

· The business logic module is compiled using the Java compiler. We need to update gradle settings to build the module. Under Gradle scripts – choose build.gradle(Module:businesslogic)

  • Add the following script at the end-
 compilJava {

    targetCompatibility = 1.7

    sourceCompatibility = 1.7

}
 

This covers your app porting! Hope you found this article useful. In the end I would suggest sharing of your code as much as possible between the two apps. If you have any questions please feel free to post in on our Multi-OS Engine Forum.


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>