How to find out the possible parameters readable from another Android app

I am running an app that launches other installed apps on an Android smartphone.

Basically, here is the code I'm using to launch another app made by me with a parameter.

Appendix 1:

PackageManager pm = getApplicationContext().getPackageManager();
Intent appStartIntent = pm.getLaunchIntentForPackage(mypackage);
    appStartIntent.putExtra("message", s);

    if (null != appStartIntent) {
        getApplicationContext().startActivity(appStartIntent);
    }

      

In my other application, this is how I get the parameter:

Application 2:

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Bundle extras = getIntent().getExtras(); 
    String result;
    try {
        result= (String) extras.getString("message");
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        recup = "nothing received";
    }

    Toast.makeText(getApplicationContext(), recup, Toast.LENGTH_SHORT).show();
}

      

The problem here is that we need to know that the second application can receive a parameter called "message".

Here is the question: Is it possible to find out all the possible parameters expected by application 2 from application 1? If so, is it possible, for example, to find out the settings accepted by any installed application on my phone? (example: Handcent, Facebook, latitude ...)

+3


source to share


3 answers


Android does not define a metadata API that will allow you to get the parameters expected by the application. Thus, it is impossible to do what you want. You will have to rely on the documentation for each application.



+2


source


this thing happened to me, so the best way I know is to decompile the target application and view the desired activity.



+1


source


You can try thinking to look inside the class and get its methods and expected parameters. Not sure if this will solve your problem completely, but this is a start ...

0


source







All Articles