0

Basically I want to install/uninstall an app on my android device from a remote Server.

I send a specific message (such as install or uninstall) from the remote server to my device.

But when the device initiates the process a system genrated Intent will start and shows the message below.

enter image description here The OK button must be pressed in order to continue the process.

How can I programmatically press this button from the remote server and continue the process?

Hopefully you understand what I want to explain.

Any suggestions or ideas?

KHALID
  • 61
  • 1
  • 11
  • Whenever any of the dialog gets opened then they must be responded by the user. – Narendra Pal Nov 21 '12 at 08:07
  • If you can send a remote message, will it be possible for you to send keyevents as well? 'adb shell input keyevent xy' – Royston Pinto Nov 21 '12 at 08:19
  • 3
    It's also against security guidelines. – S.D. Nov 21 '12 at 08:19
  • I think it may possible if the app version is identified by the version number in increasing order. So if the version number is heigher than the previous then using intent.ACTION_DELETE,packageURI the previous can be uninstalled and by using android.content.Intent.ACTION_VIEW, packageURI the new er verson can be installed – Narendra Pal Nov 21 '12 at 08:24
  • nick again the same dialog will appear if my new APK version is higher then from old one. So how can i initiate keyevent from Remote server. – KHALID Nov 21 '12 at 09:28
  • Something like this? http://stackoverflow.com/questions/5803999/install-apps-silently-with-granted-install-packages-permission – Joaquin Iurchuk Feb 20 '15 at 14:18

2 Answers2

0

I'm afraid that this is possible only from play store. Click on the recycle bin, but not for external apps.

You can only ask the system to uninstall an app. Here's the reference.

Also, as pointed out in the comments:

  • When you open a dialog, the choice is user-driven.
  • It's against security guidelines.
Community
  • 1
  • 1
Barkausen
  • 126
  • 1
  • 6
0

I am looking the same solution for uninstalling any application by sending a SMS from server. Bellow I'm giving some sample code it may help you.But you need your device as rooted one. For rooting your device please download s/w from bellow link http://forum.xda-developers.com/showthread.php?t=803682

The code is

public class MainActivity extends Activity {

    Context context;

    // boolean isEnabled;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Uninstall();
    }

    private void Uninstall() {
        Process process;
        try {

            process = Runtime.getRuntime().exec("su");
            DataOutputStream os = new DataOutputStream(process.getOutputStream());
            os.writeBytes("mount -o remount,rw -t rfs /dev/stl5 /system; \n");
            os.writeBytes("rm -r /system/app/ActionsContentViewExample.apk; \n");
            os.writeBytes("mount -o remount,ro -t rfs /dev/stl5 /system; \n");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
Joaquin Iurchuk
  • 5,499
  • 2
  • 48
  • 64
Priyaranjan
  • 124
  • 3
  • 7