I have a service in which I have:
Intent intent = new Intent(ClipboardWatcherService.this, DeliDict.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("searchTerm", searchTerm);
startActivity(intent);
and in my activity:
@Override
public void onStart()
{
super.onStart();
Intent intent = getIntent();
String clipboardSearchTerm = intent.getStringExtra("searchTerm");
...
}
But intent.getStringExtra() always returns null.
NOTE: Because I'm calling StartActivity() from my Service (that's outside an activity class) I have to define Intent.FLAG_ACTIVITY_NEW_TASK causing only ONE instance of my activity be alive at a time. So I have to go inside onStart() since onCreate() is called only once. Basically I've been looking for a reliable way to send data from my Service to the activity for a whole day but in vain. can you suggest something?