Giter Site home page Giter Site logo

habbyge / flying-pigeon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from justson/flying-pigeon

0.0 1.0 0.0 414 KB

flying-pigeon 是一个IPC 跨进程通信组件,底层是匿名内存+Binder , 突破1MB大小限制,无需写AIDL文件,让实现跨进程通信就像写一个接口一样简单

Home Page: https://github.com/Justson/flying-pigeon

License: Apache License 2.0

Java 100.00%

flying-pigeon's Introduction

Flying-Pigeon

Flying-Pigeon 是一个IPC跨进程通信组件,把跨进程通信简化到极致,并且突破binder 1MB内存大小限制。

引入

  • Gradle
implementation 'com.github.Justson:flying-pigeon:v1.0.7'

方式一

Server

private Api mApi = new Api() {
        @Override
        public int createPoster(Poster poster) {
            Log.e(TAG, "poster:" + GsonUtils.toJson(poster));
            return 11;
        }
    };

对外发布服务

ServiceManager.getInstance().publish(mApi);

Client

final Pigeon pigeon = Pigeon.newBuilder(this).setAuthority(ServiceApiImpl.class).build();
Api api = pigeon.create(Api.class);
api.createPoster(new Poster("Justson", "just", 119, 11111000L, (short) 23, 1.15646F, 'h', (byte) 4, 123456.415D));

方式二

Server

@MainThread
@route("/query/username")
public void queryUsername(final Bundle in, final Bundle out) {
    ipcLabel.setText("received other app message,\n message:" + in.getString("userid"));
    out.putString("username", "ipc-sample");
}

对外发布服务

ServiceManager.getInstance().publish(this);

Client

Pigeon flyPigeon = Pigeon.newBuilder(MainActivity.this).setAuthority("com.flyingpigeon.ipc_sample").build();
Bundle bundle = flyPigeon.route("/query/username").withString("userid", UUID.randomUUID().toString()).fly();

混淆

-keep class com.flyingpigeon.library.*
-dontwarn com.flyingpigeon.library.*

建议

  • 建议App内使用方式一,App与其他App通信使用方式二
  • 返回的类型中,尽可能使用基本数据类型的包装类、如Integer,Double,Long,Short,Float,Byte,Boolean,Character

flying-pigeon's People

Contributors

justson avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.