Just as the user who asked this: How does the default browser on Android send "SEND" intents?, I want my Android app to process a silent send. I implemented the proposed solution, a headless activity that never calls setContentView():
public class IntentMgrAct extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView explicitally ommited
Toast.makeText(getApplicationContext(), "Message sent", Toast.LENGTH_LONG).show();
}
}
When other apps send the intent to my "dumb" activity, it shows up behind the toast, but all I want is the toast. I tried to hide the headless activity with finish() after Toast.makeText and does the trick, but there is a noticeable flicker. How can I prevent the the activity from showing up?
You need to add android:theme="@android:style/Theme.NoDisplay"
to your <activity>
element in the manifest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With