My code is bellow..
In BroadcastReceiver i write like this
public class BCRDemo extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent myIntent=new Intent(context,MyService.class);
context.startService(myIntent);
}
}
In MyService class i write like this.
public class MyService extends Service {
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId){
super.onStartCommand(intent, flags, startId);
Toast.makeText(getBaseContext(), " Demo Service Started",
Toast.LENGTH_SHORT).show();
return START_STICKY;
}
}
And also i register service and broadcast receiver in manifest file..
but my problem is i am not able to see the toast and it is not visible
in Emulator Running Service
--
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