Note that there are some explanatory texts on larger screens.

plurals
  1. POError Installing with Admin Permissions
    primarykey
    data
    text
    <p>I work for a cell company, our phones are based Android(SDK 1.5) we have the ability to sign our applications in our phones and give it firmware permissions, like: </p> <p>installing an extern application while using PackageManager.(SDK 1.5)</p> <p>this is what i did:</p> <pre><code> File src = context.getFileStreamPath(fileName); Uri mPackageURI = Uri.parse(src.getAbsolutePath()); PackageManager pm = context.getPackageManager(); int installFlags = 0; try { PackageInfo pi = pm.getPackageInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES); if (pi != null) { Log.debug(TAG, TAG + ":replacing " + fileName); installFlags |= PackageManager.REPLACE_EXISTING_PACKAGE; } } catch (NameNotFoundException e) { } try { PackageInstallObserver observer = new PackageInstallObserver(); pm.installPackage(mPackageURI, observer, installFlags); } catch (SecurityException e) { //if the app is not signed by the manufacture it will get here a security exception } class PackageInstallObserver extends IPackageInstallObserver.Stub { public void packageInstalled(String packageName, int returnCode) { } } </code></pre> <p>Now this is the wierd thing i get:</p> <p>Since we are the manfucatures we dont get any exception while execute pm.installPackage(mPackageURI, observer, installFlags);</p> <p>since we have signed our app with admin permissions.</p> <p>but what we do get is this crazy result and the phone being RESTARTED.</p> <pre><code>threadid=21: thread exiting with uncaught exception (group=0x4000fe70) 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): Uncaught handler: thread PackageManager exiting due to uncaught exception 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): *** EXCEPTION IN SYSTEM PROCESS. System will crash. 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): java.lang.NullPointerException 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): at com.android.server.PackageManagerService.installPackageLI(PackageManagerService.java:3634) 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): at com.android.server.PackageManagerService.access$1500(PackageManagerService.java:120) 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): at com.android.server.PackageManagerService$5.run(PackageManagerService.java:3253) 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): at android.os.Handler.handleCallback(Handler.java:587) 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): at android.os.Handler.dispatchMessage(Handler.java:92) 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): at android.os.Looper.loop(Looper.java:123) 07-11 16:29:38.493: ERROR/AndroidRuntime(2561): at android.os.HandlerThread.run(HandlerThread.java:60) </code></pre> <p><strong>Second way:</strong> Ive also tried this way and I got diffrent exception:</p> <p>*very similar to the first way, just the major difference is in this line:</p> <pre><code> String src = String.format("file:///data/data/com.mirs.agentcore/files/%s", fileName); Uri mPackageURI = Uri.parse(src); PackageManager pm = context.getPackageManager(); String src = String.format("file:///data/data/com.mirs.agentcore/files/%s", fileName); Uri mPackageURI = Uri.parse(src); PackageManager pm = context.getPackageManager(); int installFlags = 0; .... //the rest of the code is the same as the First way(mention above) </code></pre> <hr> <p>After this code being executed(Second way), the phone continue normally, but I get this exception:</p> <p>09-12 12:10:16.484: ERROR/PackageManager(6601): Couldn't copy package file to temp file.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload