Hi, I am developing an android application in which I have a
background service that implements Generic Result Receiver.  The
service calls an Intent Service to fetch some details about each
event. Now, the problem which I am facing is when I start the
intentservice , the onreceive result of background Service is no t
invoked.
Here is the code snippet:
Background Service:
AppService.Class
public class AppService extends Service implements
GenericResultReceiver.Receiver {
public GenericResultReceiver mReceiver;
        Public AppService(String name) {
                super();
        }
        public AppService() {
                super();
        }

        @Override
        public void onCreate() {
        super.onCreate();
        mReceiver = new GenericResultReceiver(new Handler());
        mReceiver.setReceiver(this);

final Intent intt = new Intent(Intent.ACTION_SYNC, null,
getApplicationContext(), myservice.class);
intt.putExtra("receiver", mReceiver);
startService(intt);
}

        public void onReceiveResult(int resultCode, Bundle resultData) {
        switch (resultCode) {
        case MeetingQueryService.STATUS_RUNNING:
                // control not coming here
                break;
                case MeetingQueryService.STATUS_FINISHED:
        //Control not coming here
                break;
                case MeetingQueryService.STATUS_ERROR:
                break;
                }
        }

IntentService :myservice.java
public class myservice extends IntentService {
        public  myservice(String name) {
                super(name);    }

        public  myservice() {
                super(myservice.class.getSimpleName());
        }
                @Override
public void onCreate() {
        super.onCreate();
   }
@Override
protected void onHandleIntent(Intent callerIntent) {
final ResultReceiver receiver =
callerIntent.getParcelableExtra("receiver");
        receiver.send(STATUS_RUNNING, Bundle.EMPTY);
// the above command not invoking onReceive

        receiver.send(STATUS_FINISHED, b);
// the above command not invoking onReceive
}
        }

So, after the onhandle intent of Meetingqueryservice is called, the
onReceiveResult of AppService is not invoked.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to