0

This is my first question so please don't be so harsh.

Basically I want to open a 3rd party android app with mine and do something with that 3rd party app like search in a searchfield.

I know how to just open another app (with intent) but that doesn't really provide the option of doing anything, it just launches the app.

I also know of Uris which are used in for example the play store ("market://...") but the app I want to do something with doesn't really provide anything like that.

I don't care if it is only possible with root btw.

I hope what I want to achieve is actually possible :P

Thanks a lot,

fandroid

fandroid
  • 1
  • 1

2 Answers2

1

It depends on another app. You can provide extra information trough your Intent, and other app may determine what to do with it. I'll provide example shortly.

A good example is Barcode Scanner application.

Create intent and start Barcode Scanner trough intent. Barcode Scanner will open up, and once it scans the image, it will open your application with new intent.

String packageString = "com.google.zxing.client.android";
    if (isPackageInstalled(packageString)) {
        Intent intent = new Intent(packageString + ".SCAN");
        intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
        startActivityForResult(intent, 0);
    }
...
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
            String contents = data.getStringExtra("SCAN_RESULT");
            // String format = data.getStringExtra("SCAN_RESULT_FORMAT");
            Toast.makeText(MainActivity.this, contents, Toast.LENGTH_LONG)
                    .show();
            // Handle successful scan
        } else if (resultCode == RESULT_CANCELED) {
            // Handle cancel
        }
    }
}
Marius
  • 810
  • 7
  • 20
  • That example is working great but unfortunately this only works with applications that can handle this kind of intent. I am searching for something that works without the application supporting that behavior. – fandroid Aug 25 '14 at 13:15
  • That's impossible. Each action that app does must be defined in .java files. You can't simply pass plain text to method as you can in Javascript and expect that text to be executed. – Marius Aug 25 '14 at 13:43
  • But is it still impossible with root access? Because there are some applications out there that can change certain values of an app (GameGuardian,...). I'm pretty sure that there is a way to do this, but it probably won't be very easy to do... – fandroid Aug 25 '14 at 13:52
  • GameGuardian does not start other application. It simply reads other app's sharedPreferences files. – Marius Aug 25 '14 at 13:58
  • @Marius GameGuardian does not reads other app's sharedPreferences files. It simply change memory of process. – Enyby Aug 25 '17 at 11:39
0

There is a solution, but for it to work you have to run dalvik, ART is not supported atm.

Xposed works great for hooking methods from other applications.

Check out the developmet tutorial here: https://github.com/rovo89/XposedBridge/wiki/Development-tutorial

fandroid

fandroid
  • 1
  • 1