yifei8 / ABridge

Android 进程间通信最牛方案,为简单而生
https://www.jianshu.com/p/46134eef5703
291 stars 51 forks source link

开启两个app可以互相通信吗 #3

Open lxhtiamo opened 6 years ago

lxhtiamo commented 6 years ago

开启两个app可以互相通信吗

lxhtiamo commented 6 years ago

服务那边怎么接收客户端发过来的消息?

yifei8 commented 6 years ago

可跨APP通信,源码中含demo,server & client,先启动server,就可以相互发送数据进行通信了,详细可以参考demo

lxhtiamo commented 6 years ago

就是使用的你的demo 实现不来通信.只能在自己的Activity 发送和接收`````

lxhtiamo commented 6 years ago

使用message方案这里有时候出现空指针,,, aidl 的方案好很多,,,而且message 方案需要 Service 先发送一条消息给client 才能建立连接, 如果是client 先发送消息给Service 则连接不上..

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Messenger.send(android.os.Message)' on a null object reference at com.sjtu.yifei.messenger.MsgerActivityLifecycleCallbacks.unBindService(MsgerActivityLifecycleCallbacks.java:84) at com.sjtu.yifei.messenger.MsgerActivityLifecycleCallbacks.onActivityStopped(MsgerActivityLifecycleCallbacks.java:116)

yifei8 commented 5 years ago

非常感谢你的疑问,为了提供更灵活的API,现已经更新库,新版本不在局限于Activity使用。你可以在任意地方使用,同时也增加了容错处理。 https://github.com/yifei8/ABridge

林星辉 notifications@github.com 于2018年8月13日周一 上午11:31写道:

使用message方案这里有时候出现空指针,,, aidl 的方案好很多,,,而且message 方案需要 Service 先发送一条消息给client 才能建立连接, 如果是client 先发送消息给Service 则连接不上..

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Messenger.send(android.os.Message)' on a null object reference at com.sjtu.yifei.messenger.MsgerActivityLifecycleCallbacks.unBindService(MsgerActivityLifecycleCallbacks.java:84) at com.sjtu.yifei.messenger.MsgerActivityLifecycleCallbacks.onActivityStopped(MsgerActivityLifecycleCallbacks.java:116)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/yifei8/ABridge/issues/3#issuecomment-412400157, or mute the thread https://github.com/notifications/unsubscribe-auth/AgvL_lDCRWFOkTpqqiPPF6Mm96_icIrfks5uQPMngaJpZM4V3zbF .

ObliverDeleopers commented 4 years ago

就是使用的你的demo 实现不来通信.只能在自己的Activity 发送和接收`````。。。。。这个解决了没?