0

I m creating an app which opens another app in the background and my first app will be sending some string as a data to another app, so can I send Intents to another app's like we usually send intents to other classes containing data?

If we can then how can I send it?

  • You need to search first. I found this : http://stackoverflow.com/a/2780475/1405983 – Hardik Joshi Jan 17 '14 at 06:52
  • question lacks originality. Please Google first. – Ana Jan 17 '14 at 07:12
  • Possible duplicate of [Open another application from your own (intent)](https://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent) – hyde May 06 '19 at 12:30

3 Answers3

1

Yes , you can send the intent to any app you like but its upto the receiving application to handle it. Few apps may crash receiving it.

The way

Make an intent

Intent i=new Intent(yourContext,Activity_to_which_you_to_send.class);

Put some data-if you want to

i.putExtraString("key","value");

or put using a bundle
Bundle b=new Bundle();
b.putString(key,boolean_value);
b.putBoolean(key,boolean_value)

Starting the activity

startActivity(i);

Set the package of the app

i.setPackage("com.whatsapp");

Example

if you want to find out the main Activity of an app

go to command line type adb shell pm -lf

pick any one and try it by passing as a second argument to the intent constructor defined above and then call startActivity method.

hope it helps you.

cafebabe1991
  • 4,416
  • 1
  • 25
  • 36
0

Yes you can send Intent to another app like we send to other classes with passing data as a string so you can see it HERE

Community
  • 1
  • 1
Anas Reza
  • 484
  • 1
  • 6
  • 23
-2

Yes. "App" is not so well defined on Android, it's a loose term. Intents are used to start an Activity, among other things.

SK9
  • 29,437
  • 32
  • 112
  • 154