passing custom object to android service in different process -


i have service set start in separate process:

<service android:name=".services.uploadservice"           android:process=":uploadserviceprocess" /> 

and can bind using bindservice(). issue occurs when try send message calling messenger.send():

service.send(message.obtain(null, uploadservice.message_upload_request, uploadrequest)); 

where uploadrequest custom object implements parcelable

 public class uploadrequest implements parcelable {     public file file;     public boolean deleteonupload;

public uploadrequest(file file, boolean deleteonupload) {     this.file = file;     this.deleteonupload = deleteonupload; }  private uploadrequest(parcel in) {     this.file = new file(in.readstring()); }  public int describecontents() {     return 0; }  public void writetoparcel(parcel dest, int flags) {     dest.writestring(this.file.getpath()); }  public static final parcelable.creator<uploadrequest> creator = new parcelable.creator<uploadrequest>() {     public uploadrequest createfromparcel(parcel in) {         return new uploadrequest(in);     }     public uploadrequest[] newarray(int size) {         return new uploadrequest[size];     } }; 

}

i set breakpoint in services handlemessage, app never gets breakpoint. however, if instead of using custom uploadrequest object send null, handlemessage breakpoint i'd expect, can't @ point. i've verified file.getpath() when calling writetoparcel returns non null string. leads me believe off in uploadrequest class, googling can't see wrong class. ideas?

the documentation of message member obj says:

an arbitrary object send recipient. when using messenger send message across processes can non-null if contains parcelable of framework class (not 1 implemented application). other data transfer use setdata(bundle). note parcelable objects here not supported prior froyo release.

my guess seeing issue because creating own parcelable not allowed when crossing process boundary. instead, you'll have package object bundle. means object need implement serializable not need parcelable.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -