I copy My trouble from another thread:
I had a simple app that has Service and Application.
Application starts Service by Action with Intent.
The Service received Intent with onStartCommand and handle some action
by
key that is in Intent.
Sometime Service receives empty Intent.
public void sendRequest(int type, Intent data) {
Intent i = new Intent(getLocalServiceAction());
i =
i.putExtras(data).putExtra(LocalApiService.INTENT_NAME_REQUEST_ID,
type);
startService(i);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
onHandleIntent(intent);
}
return START_REDELIVER_INTENT;
}
protected void onHandleIntent(Intent intent) {
prepareDataFromReceiver(intent);
}
public void prepareDataFromReceiver(Intent extras) {
int type =
extras.getIntExtra(LocalApiService.INTENT_NAME_REQUEST_ID, -1);
//Sometime type doesn't in Intent
...
}
I have fixed my problem with service manifest
parameter( android:process=":MyService");
On 19 Кві, 14:18, TreKing <[email protected]> wrote:
> On Thu, Apr 19, 2012 at 3:04 AM, viktor <[email protected]> wrote:
> > Didn't fix my problem, after a long time I still receive an empty Extras,
> > it is on 2.1.
>
> You need to explain your problem better. Like what is "a long time". What
> is different between these times?
>
> ---------------------------------------------------------------------------
> ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
--
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