情景如下:
俩个application: local app和remote app
local app activity通过aidl和remote app service进行数据传输。
当local app 调用remote service接口时, remote app service通过网络获得值,当获取的值达到一定条件时,remote service启动一个remote activity.
用户在remote activity中进行一系列操作后,将remote activity中的操作结果返回给remote service, 然后由reomte service将结果返回给local activity.
问题就出在remote activity返回到remote service的时候, remote service中的变量值都变成null了.
代码比较多,就不贴出来了.
http://androidgill.blogspot.com/2011/12/pass-data-7-aidlcallbackapkactivityserv.html
跟这个差不多,就多了remote service调用remote activity并返回这一步。
有哪位大神遇到这个问题没? 或者有思路提供也行。
谢谢所有参与回帖的。aidlandroid 数据保存aidlservice数据保存

解决方案 »

  1.   

    表示遇到类似问题了  onStartCommand里面传进去的启动intent都为空  莫名其妙啊
      

  2.   

    已解决, 谢谢
    开始用的broadcastreceiver从remote activity传递消息给remote service的,中间new了一次remote service,所以导致上面的情况。
    读了文档才发现:
    A service can be both started and have connections bound to it. In such a case, the system will keep the service running as long as either it is started or there are one or more connections to it with the Context.BIND_AUTO_CREATE flag.
    在remote activity中直接startservice调用remote service中的onStartCommand就搞定了.
      

  3.   

    是不是你调用startservice(intent)中的intent是null啊?
      

  4.   

    是不是你调用startservice(intent)中的intent是null啊?
    嗯 是滴  无缘无故  不知道为什么  我的app也是用到了aidl(不过现在没用了)