Convert Figma logo to code with AI

Tencent logoVasSonic

VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.

11,811
1,610
11,811
44

Top Related Projects

8,125

A powerful Android Dynamic Component Framework.

A powerful and lightweight plugin framework for Android

4,412

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.

1,366

A hotfix library for Android platform, and not just this...

RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework

48,780

The Kotlin Programming Language.

Quick Overview

VasSonic is an open-source, lightweight, and high-performance hybrid framework developed by Tencent for Android and iOS platforms. It aims to improve web page loading speeds and optimize the user experience by implementing a hybrid loading solution that combines the advantages of native apps and web applications.

Pros

  • Significantly improves web page loading speed, especially on slow networks
  • Supports both Android and iOS platforms
  • Provides a seamless integration between native and web content
  • Offers a flexible plugin system for customization and extension

Cons

  • Requires additional setup and integration compared to traditional web development
  • May have a learning curve for developers unfamiliar with hybrid app development
  • Limited documentation and examples available in English
  • Potential compatibility issues with certain web frameworks or libraries

Code Examples

  1. Initializing VasSonic in Android:
SonicConfig.Builder builder = new SonicConfig.Builder();
builder.setSessionConfig(new SessionConfig.Builder().build());
SonicEngine.createInstance(builder.build(), new SonicRuntime() {
    // Implement runtime methods
});
  1. Loading a URL with VasSonic in Android:
SonicSession session = SonicEngine.getInstance().createSession(url, null);
if (session != null) {
    session.bindClient(new SonicSessionClientImpl());
    Intent intent = new Intent(this, WebActivity.class);
    intent.putExtra(WebActivity.PARAM_URL, url);
    intent.putExtra(WebActivity.PARAM_MODE, SonicConstants.MODE_DEFAULT);
    startActivity(intent);
}
  1. Implementing VasSonic in iOS:
let configuration = SonicConfiguration.default()
SonicEngine.shared().run(withConfiguration: configuration)

let sessionConfiguration = SonicSessionConfiguration.default()
let session = SonicSession(url: URL(string: "https://example.com")!, configuration: sessionConfiguration)
session.delegate = self

let webViewController = WebViewController()
webViewController.sonicSession = session
navigationController?.pushViewController(webViewController, animated: true)

Getting Started

To integrate VasSonic into your Android project:

  1. Add the dependency to your app's build.gradle:

    dependencies {
        implementation 'com.tencent.sonic:sonic-sdk:3.1.0'
    }
    
  2. Initialize VasSonic in your Application class:

    public class MyApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            SonicEngine.createInstance(new SonicRuntimeImpl(this), new SonicConfig.Builder().build());
        }
    }
    
  3. Use VasSonic to load web pages in your activities or fragments.

For iOS integration, refer to the project's documentation for CocoaPods or manual installation instructions.

Competitor Comparisons

8,125

A powerful Android Dynamic Component Framework.

Pros of Atlas

  • Focuses on modular development and dynamic deployment for Android apps
  • Supports hot-fixing and dynamic loading of components
  • Provides a comprehensive framework for large-scale app development

Cons of Atlas

  • More complex setup and learning curve compared to VasSonic
  • Primarily designed for Android, limiting cross-platform usage
  • May introduce overhead for smaller applications

Code Comparison

Atlas (Java):

Atlas.getInstance().installBundleTransversal(bundleFile);
Atlas.getInstance().installBundleTransversal(bundleFile, InstallerConstants.INSTALL_ALLOW_DOWNGRADE);

VasSonic (JavaScript):

sonic.getData(url).then(result => {
    if (result.data) {
        // Handle data
    }
});

Key Differences

  • Atlas focuses on modular app architecture, while VasSonic emphasizes web page loading optimization
  • Atlas is primarily for Android development, whereas VasSonic is designed for hybrid and web applications
  • Atlas offers more extensive features for large-scale app development, while VasSonic is more lightweight and focused on specific performance improvements

Use Cases

  • Choose Atlas for complex Android apps requiring modular architecture and dynamic updates
  • Opt for VasSonic when optimizing web page loading in hybrid or web applications

Community and Support

  • Both projects have active communities and are maintained by large tech companies (Alibaba and Tencent)
  • Atlas has more stars and forks on GitHub, indicating wider adoption in the Android development community

A powerful and lightweight plugin framework for Android

Pros of VirtualAPK

  • Enables dynamic loading of Android plugins without app reinstallation
  • Supports running multiple plugins simultaneously within a host app
  • Allows for modular app development and easier updates

Cons of VirtualAPK

  • More complex setup and integration compared to VasSonic
  • Requires careful management of plugin versions and dependencies
  • May have a larger impact on app size due to plugin architecture

Code Comparison

VirtualAPK:

PluginManager pluginManager = PluginManager.getInstance(context);
pluginManager.loadPlugin(pluginPath);
Intent intent = new Intent();
intent.setClassName(packageName, activityName);
startActivity(intent);

VasSonic:

SonicSessionConfig.Builder sessionConfigBuilder = new SonicSessionConfig.Builder();
sessionConfigBuilder.setSupportLocalServer(true);
SonicEngine.getInstance().runSessionAsync(url, sessionConfigBuilder.build(), callback);

VirtualAPK focuses on plugin management and dynamic loading, while VasSonic emphasizes web page loading optimization. VirtualAPK's code demonstrates plugin loading and activity launching, whereas VasSonic's code shows session configuration for optimized web content loading.

4,412

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.

Pros of Robust

  • Focuses on Android app stability and crash prevention
  • Provides a comprehensive set of tools for handling various runtime exceptions
  • Offers a plugin-based architecture for easy integration and customization

Cons of Robust

  • Limited to Android platform, while VasSonic supports both Android and iOS
  • May introduce additional overhead due to its extensive exception handling mechanisms
  • Requires more setup and configuration compared to VasSonic's simpler implementation

Code Comparison

Robust:

@Modify
public int foo(String s, int i) {
    return s.length() + i;
}

VasSonic:

SonicSession session = SonicEngine.getInstance().createSession(url, sessionConfig);
if (null != session) {
    session.bindClient(clientCallback);
}

The code snippets demonstrate the different focus areas of each project. Robust uses annotations for method modification, while VasSonic deals with session management for web optimization.

1,366

A hotfix library for Android platform, and not just this...

Pros of Amigo

  • More comprehensive framework for Android app optimization
  • Supports hot-fix patching for quick bug fixes without app updates
  • Offers dynamic resource loading for better app performance

Cons of Amigo

  • More complex setup and integration compared to VasSonic
  • Limited to Android platform, while VasSonic supports both Android and iOS
  • Less focus on web acceleration, which is a key feature of VasSonic

Code Comparison

Amigo (Java):

Amigo.init(this);
Amigo.work(this);

VasSonic (Java):

SonicEngine.getInstance().init(this);
SonicSession session = SonicEngine.getInstance().createSession(url, null);

Both frameworks aim to improve mobile app performance, but they take different approaches. Amigo focuses on overall Android app optimization, including hot-fixing and resource management, while VasSonic specializes in web acceleration and hybrid app performance. Amigo offers more comprehensive features for Android development, but VasSonic provides cross-platform support and is easier to integrate for web-centric applications. The choice between the two depends on the specific needs of the project and the target platforms.

RePlugin - A flexible, stable, easy-to-use Android Plug-in Framework

Pros of RePlugin

  • Supports dynamic loading of plugins without restarting the app
  • Provides better isolation between plugins and the host app
  • Offers a more comprehensive plugin management system

Cons of RePlugin

  • More complex setup and configuration compared to VasSonic
  • Potentially larger app size due to plugin architecture
  • May have a steeper learning curve for developers

Code Comparison

RePlugin (Plugin registration):

RePlugin.registerHookingClass("com.qihoo360.replugin.sample.demo1.MainActivity",
    PluginDemo1.class.getName(), "com.qihoo360.replugin.sample.demo1.MainActivity");

VasSonic (Web optimization):

SonicEngine.getInstance().runSonicFlow(url, builder.build(), new SonicSessionClientImpl());

While RePlugin focuses on plugin management and dynamic loading, VasSonic is primarily designed for web optimization and faster page loading. RePlugin offers more flexibility in terms of app architecture and feature modularization, but it comes with increased complexity. VasSonic, on the other hand, provides a simpler solution for improving web performance within mobile apps.

The code examples highlight the different focus areas of each project. RePlugin's code demonstrates plugin registration, while VasSonic's code shows how it optimizes web content loading.

48,780

The Kotlin Programming Language.

Pros of Kotlin

  • Kotlin is a full-fledged programming language with broader applications
  • Offers strong type safety and null safety features
  • Provides excellent interoperability with Java

Cons of Kotlin

  • Steeper learning curve for developers new to the language
  • Compilation time can be slower compared to Java
  • Limited resources and community support compared to more established languages

Code Comparison

VasSonic (JavaScript):

sonic.getData(function(data) {
    if (data.code == 0) {
        // Handle successful data retrieval
    }
});

Kotlin:

val data = fetchData()
when (data) {
    is Success -> handleSuccess(data.value)
    is Error -> handleError(data.exception)
}

While VasSonic focuses on optimizing web page loading speed for Android, Kotlin is a versatile programming language used for various applications, including Android development. VasSonic provides specific optimizations for hybrid apps, whereas Kotlin offers a more comprehensive solution for building entire applications. The code comparison illustrates the difference in approach: VasSonic uses callback-based JavaScript for data handling, while Kotlin employs a more structured, type-safe approach with sealed classes for error handling.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

VasSonic: A Lightweight And High-performance Hybrid Framework

license PRs Welcome wiki

logo

VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform. Not only does VasSonic supports the static or dynamic websites which are rendered by server, but it is also compatible with web offline resource perfectly.

VasSonic uses custom url connection instead of original network connection to request the index html, so it can request resource in advance or parallel to avoid waiting for the view initialization. In this parallel case, VasSonic can read and render partial data by WebKit or Blink kernel without spending too much time waiting for the end of data stream.

VasSonic can cache html cleverly according to VasSonic Specification obeyed by client and server. VasSonic Specification specify template and data by inserting different comment anchor, templates are bigger parts of html which stay the same or changed rarely , in contradiction data, which is the smaller and constantly change part of html. According to this, VasSonic request less data by incremental updating templates and data, the websites are faster and feel more like native application. In conclusion, VasSonic effectively enhance the user experience and increase click rate, retention rate and other indicators.

Sonic is called for short in project.

Before VS After Using VasSonic

Pic 1: Before Using VasSonicPic 2: After Using VasSonic
default modeVasSonic mode

Getting started

Getting started with Android

Getting started with iOS

Getting started with Java

Getting started with Node.js

Getting started with PHP

Getting started with React

Demo Downloads

  1. Here are the latest sample demo for Android and iOS.

Support

Any problem?

  1. Learn more from the following sample.
    Android sample
    iOS sample
    Java sample
    Node.js sample
    PHP sample
    React sample

  2. Read the following source code
    Android source code
    iOS source code
    Java source code Node.js source code
    PHP source code
    React source code

  3. Read the wiki for help.

  4. Contact us or scan QR code for help.
    QR code

Contributing

For more information about contributing issues or pull requests, see our VasSonic Contributing Guide.

License

VasSonic is under the BSD license. See the LICENSE file for details.

The End

If you are interested in VasSonic, don't forget to STAR it.

VasSonic's mission is MAKING WEB MUCH BETTER!

Thank you for reading ~