0

I want to communicate with an APP in android device using socket. We will send and receive many parcel objects. App will get some system information and it will be easier using parcel. So I have to do more things to parse parcel object...

I can use python or java or jython. But there are no tools to parse parcel.

I want to use Parcel class in android by android.jar, but Exception in thread “main” java.lang.RuntimeException: Stub, Because android.jar cant use in standalone project.

I try Robolectric, But Parcel need native write and read. I get libandroid_runtime.so and load it, wrong ELF class: ELFCLASS32(I work in 64bit ubuntu)...

Except transplant android code to host, are there other methods? Thanks!

Community
  • 1
  • 1
efei
  • 281
  • 1
  • 3
  • 14

2 Answers2

0

I beleive that using of gson library is more native and usual way for network communication on Android.

If it does not fit your needs, you can use Serializable with custon writeObject/readObject, but I would strongly advise you to json because it is easier to debug and you dont need to care about 100% Serializable compartibility.

konmik
  • 3,150
  • 19
  • 15
  • Yes, I want to use json. But they are first party, and they can serialize data in some class directly using parcel because those classes implement parcelable. Alas! – efei Oct 10 '14 at 13:02
0

Parcel and Parcelable are designed for use within a device. They are not well-suited for use between different environments, and they are useless outside of Android.

Please use something else for cross-environment/cross-language communciation, like JSON, XML, protobuf, or Thrift.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491