Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于这个库的个人理解~ #11

Open
fashare2015 opened this issue Apr 18, 2017 · 2 comments
Open

关于这个库的个人理解~ #11

fashare2015 opened this issue Apr 18, 2017 · 2 comments
Labels

Comments

@fashare2015
Copy link

@ClassId(“Singleton”)
public interface ISingleton {

    @MethodId(“setData”)
    void setData(String data);

    @MethodId(“getData”)
    String getData();

}

@ClassId(“Singleton”)
public class Singleton {
    ...

    @MethodId(“setData”)
    public void setData(String data) {
        mData = data;
    }

    @MethodId(“getData”)
    public String getData() {
        return mData;
    }

}
  1. ISingleton 基本就是 java 版的 AIDL
  2. Singleton 可以看做 extends ISingleton.Stub (代入到AIDL视角的话)
  3. 底层由 Service + Binder 实现
  4. 使用了动态代理,某种程度上有点像Retrofit

不知道有没有理解偏了。

@Xiaofei-it
Copy link
Owner

Xiaofei-it commented May 5, 2017

@fashare2015 对,你的理解没错。^.^

主要是把android binder机制封装一下,让用户不用关心底层通信原理,这样IPC开发就可以变得简单。

@ivanyang1984
Copy link

请问一下 annotation上面写的classId 要写package 名字吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants