1

I'm developing a custom launcher for android based signage (using MiniPC not a device), and follow this thread -> uninstall app silently with system priveleges to enable silent uninstall of 3rd party APK, which is required to do remote install & uninstall by our signage admin.

My implementation that follows the code from the above thread is like below

private class PackageDeleteObserver extends IPackageDeleteObserver.Stub {
    @Override
    public void packageDeleted(String packageName, int returnCode) throws RemoteException {
    }
}

//.... other codes ... //

@Override
protected void onHandleIntent(Intent intent) {

//.... other codes ... //

    for (int x = 0; x < compliances.size(); x++) {
        deleteObserver = new PackageDeleteObserver();
        packageManager = getPackageManager();
        Class<?>[] uninstalltypes = new Class[] {String.class, IPackageDeleteObserver.class, int.class};
        Method uninstallMethod = packageManager.getClass().getMethod("deletePackage", uninstalltypes);

        AppShortcut asc = compliances.get(x);
        if (existing.contains(asc) && !asc.isInstalled()) {
           uninstallMethod.invoke(packageManager, new Object[] {asc.getName(), deleteObserver, 0});
        }
     }
}

While my manifest with error signs on permission is like below

enter image description here

But I ignore those error signs, and using Genymotion emulator I ran it and I got below error in logcat

enter image description here

Please if anybody had made this works help me...

Community
  • 1
  • 1
Bromo Programmer
  • 670
  • 2
  • 13
  • 37
  • It's my area of expertise, but everything I've heard, and all the comments in the linked article, all say that this will only work on a rooted phone (or rooted emulator?) or if you app has been signed with a "platform certificate". **tl;dr**: Google will have made damn sure that someone can't silently (un)install an APK without being Google or an OEM. – TripeHound Jan 16 '17 at 11:39
  • Should have been "_It's **not** my (main) area of expertise..._" – TripeHound Jan 16 '17 at 12:22
  • Genymotion is by default rooted emulator, and android os which I installed in our minipc (not a mobile phone or tablet) also rooted. – Bromo Programmer Jan 16 '17 at 14:24
  • The messages you posted suggested it isn't (or, at least, that rooting hasn't been turned on). – TripeHound Jan 16 '17 at 14:45
  • I turn on Super User app (included in Geny and Android that I use in MiniPC) ... and still the errors appears... :(( – Bromo Programmer Jan 17 '17 at 08:18

0 Answers0