-1

I have a service application. I need to send a string to any application (browser, word, ...wherever the keyboard cursor focused). How can I do this?

//onReceive of my service onStartCommand...
@Override
public void onReceive(Context context, Intent intent) {
    String textToSend = intent.getStringExtra("data");
    if(textToSend!=null && textToSend.length()>0) {

        //Here I need send "textToSend" to another application 

    }else{
        Toast.makeText(context, "Error! ", Toast.LENGTH_SHORT).show();
    }
}
Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30

1 Answers1

0

You can achieve it with Intents. Passing the string value in the URL, specifically: http://developer.android.com/training/sharing/send.html.


You can check this question for more info.

André Sousa
  • 1,692
  • 1
  • 12
  • 23