How to pass data both ways between different android applications?

后端 未结 6 1236
甜味超标
甜味超标 2021-02-15 10:38

What\'s the easiest way to pass string variables from one application to another and also return values back? I have access to the source code of both apps, but

6条回答
  •  不要未来只要你来
    2021-02-15 11:31

    I have two apps that i pass data to/from.

    App1...
    Intent i = new Intent("com.xxx.yyy.MESSAGE");
    Bundle b = new Bundle();
    b.putString("AAA", getAAA());
    i.putExtra("MyData", b);
    startActivityForResult(i, "myProcess");
    

    nothing fancy there...

    App2...in onResume()...

     Intent i = getIntent();
     if (i != null && i.getAction().equals("com.xxx.yyy.MESSAGE") {
        ...get the data from the bundle
     }
    

    note that the AndroidManifest.xml (for App2) has the following entries for one of the activities

     
        
        
        
     
    

提交回复
热议问题