Research and practice of mobile cross-platform based on native

Source: Internet
Author: User

Based primarily on WEBVIEW+H5 comparisons, based on H5 I don't want to talk anymore, I want to try out the so-called native experience from UI to functionality that is native rather than simulated with H5.

Background

We consider from a development perspective, if you want to engage in long-term development work, have their own technical accumulation, the simplest is some UI components and functional components of the package.

For example, I implemented a click in an app to automatically switch the background color of the button, including click on the animation effect, I would certainly consider encapsulation into a class, such as called MyButton, under Android It inherits the Button class, under iOS it inherits the UIButton class. To do the next app, I'll reuse the MyButton class file directly into a new project, or reference a jar package or a file.

Still not enough, I would also like to further, I want to make the development of the app and do the original development completely separated, the native developer does not need to understand and touch any app business, only need to encapsulate similar mybutton this component provides to the app developer to use, And app developers are developers who don't need to understand Android and iOS technology. Reactnative can only be part of the separation, do not really cross-platform, I would like to do a real development across the Android and iOS platform, there is no possibility of implementation, how to achieve?

Problem

The idea is simple, but really careful to study the feasibility, will find a huge amount of questions and details need to consider and research, I first listed 19 basic questions:

  1. To cross-platform, the most basic is to choose a third-party language, if you consider the runtime must prefer JavaScript or a scripting language such as Lua. You can also use a compiled language like Xamarin, but the difficulty is definitely greater.

  2. If you want the UI to cross-platform, regardless of HTML, you have to use JSON or XML to describe the UI hierarchy.

  3. If you use JSON and XML to describe, you need to have a visual tool to facilitate user development UI, or direct text editing is unthinkable.

  4. If you use JS, you need to choose the JS engine, is Jscore or V8, which need to study differences and pros and cons.

  5. How is Android most basic activiy encapsulated in iOS corresponding to Uiviewcontrolller? How is life cycle considered? There is a need to think about multi-tier, how data interacts between tiers?

  6. JS Engine instance does the whole app use one or more? Do you need to release it? How to release?

  7. How is Android file management and iOS unified? There are similarities and differences between the two.

  8. What do threads do, allowing app business developers to build and use threads directly?

  9. Android Besides activity also has services and other basic components, iOS can not find the corresponding, how to unify?

  10. Although not with H5 as the core, but WebView certainly want to support, that webview H5 how to interact with the native? How to let WebView load the H5 JS and cross-platform framework of JS communication?

  11. Certainly need a unified event mechanism, including button click on this system event processing, also including custom events, how to design and implement the unified event mechanism of Android and iOS?

  12. This piece of the screen is very cumbersome, and our goal is to let app business developers try not to think about the details, how to design and implement them.

  13. Layout How to design, Android has a lot of layout classes, iOS a little bit is the absolute layout, this piece how unified?

  14. Similar list types of components should have a unified approach, List of the reuse mechanism in Android and iOS have similar concepts, Android with Listview,ios with UITableView, how unified?

  15. How to debug when writing code? Modify a little UI or logic code, how to see the effect immediately? Can one step? How do I see real-time error messages and debugging information?

  16. What about Android and iOS flash-back? App developers don't know how Android and iOS are dealing with flash-back issues?

  17. After the code is written, how do I package the build for Android and iOS? If the external service, how to replace the certificate, some third-party key, packaging failed to do, this requires a complete cloud packaging services, there are many problems to be solved.

  18. How do I extend a feature? In addition to us, how can other native developers be allowed to extend functionality?

  19. How to implement the component plug-in, can be cropped as needed, how to ensure that multiple components packaging conflicts?

I'm just listing some of the technical issues, and the different solutions for each problem can lead to countless small problems. We want to achieve this framework of external services, in addition to technical aspects, there are many non-technical factors we will not mention.

Scheme

The resolution of each problem can be analyzed for a long time, so we can only say a general brief about it. The follow-up can be addressed separately for specific issues.

    1. Debugging and the final release app are all plug-in and can be cropped

    2. There is a component store maintained by us and other native developers

    3. App developers use the visual IDE to drag and drop the UI, write logic with JS code, populate the data, update the UI

    4. There is a cloud packaging system that combines the JS code and UI files developed by the app developer with the native development components to compile and package

    5. The core framework contains the runtime scripting engine parsing the JS code, including the UI parsing engine parsing the JSON and building the native UI tree.

Practice

Deviceone from the beginning of 2015 design and Development, released by September 2015, from the release to now 1.5, it is not a research project, but the service of a number of developers of a platform-level product, there are hundreds of apps online. This cross-platform idea I guess everyone is not difficult to think about, but from the idea to the realization of the product, the domestic is still rare, our efforts to prove that this idea is feasible and can achieve good results, hope to inspire everyone.

Research and practice of mobile cross-platform based on native

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.