Application:

public void sendRequest(int type, Bundle data) {
                Intent i = new Intent(getLocalServiceAction());
                data.putInt(LocalApiService.INTENT_NAME_REQUEST_ID, type);
                i.putExtras(data);
                ALLogger.log(Log.DEBUG, TAG, "sendRequest, type: " + type + ",
intent: " + i + ", data: " + data);
                startService(i);
        }

Service:

@Override
        public int onStartCommand(Intent intent, int flags, int startId) {
                if (intent != null) {
                        onHandleIntent(intent);
                }
                return START_STICKY;
        }

        protected void onHandleIntent(Intent intent) {
                int type =
intent.getIntExtra(LocalApiService.INTENT_NAME_REQUEST_ID, -1);
                prepareDataFromReceiver(type, intent.getExtras());
        }



On 18 Кві, 19:38, Justin Anderson <[email protected]> wrote:
> > Sorry, it is problem with Service.
> > this one:
> >http://groups.google.com/group/android-developers/browse_thread/threa...
>
> Sorry, but a link to an identical problem posted by you doesn't prove this
> is a problem with the Service class..
>
> What does your code look like when you start the service?  And what does
> your service code look like where you try to get the Intent extras?
>
> Thanks,
> Justin Anderson
> MagouyaWare Developerhttp://sites.google.com/site/magouyaware
>
>
>
>
>
>
>
> On Wed, Apr 18, 2012 at 9:49 AM, viktor <[email protected]> wrote:
> > Sorry, it is problem with Service.
>
> > this one:
> >http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > On 18 Кві, 18:14, Justin Anderson <[email protected]> wrote:
> > > What action are you receiving?  Is it your own custom action or one
> > defined
> > > by Android?  If it is a custom action then you would need to figure out
> > why
> > > you are sending the broadcast without extras.
>
> > > If it is defined by Android, then it may be some other application that
> > > sends the broadcast, in which case you could probably ignore it if there
> > > are no extras.
>
> > > Thanks,
> > > Justin Anderson
> > > MagouyaWare Developerhttp://sites.google.com/site/magouyaware
>
> > > On Wed, Apr 18, 2012 at 3:00 AM, viktor <[email protected]>
> > wrote:
> > > > Hi,
>
> > > > I had a simple app that has Service and Application.
>
> > > > Service sends broadcasts by Action with extras.
>
> > > > Application receive this broadcast and handle some action by key that
> > > > is in extras.
>
> > > > Sometime application receive empty extras, so if I get
> > > > Intent.getExtras(), the Bundle will be empty;
>
> > > > Any workarounds?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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

Reply via email to