Install .apk file via code

Put your problem here if it does not fit any of the other categories.

Install .apk file via code

Postby kums » Fri Dec 18, 2009 12:29 pm

Hi,

How can i install .apk file via coding part.

Can anyone help me.

Thanks
kums
Freshman
Freshman
 
Posts: 8
Joined: Wed Nov 18, 2009 8:50 am

Top

Postby kums » Mon Dec 21, 2009 8:42 am

Hi All,

Am used following code for .apk installation

File apkFile = new File("/sdcard/Trailers.apk");
Uri appUri = Uri.fromFile(apkFile);
PackageManager pManager = getPackageManager();
pManager.installPackage(appUri,listener,PackageManager.PERMISSION_GRANTED);


In Manifest am using :
<uses-permission android:name="android.permission.INSTALL_PACKAGES"></uses-permission>

but still i got error like below:

java.lang.SecurityException: Neither user 10027 nor current process has android.permission.INSTALL_PACKAGES.

How to solve this problem?
Help me.

Thanks
kums
Freshman
Freshman
 
Posts: 8
Joined: Wed Nov 18, 2009 8:50 am

Postby kums » Mon Dec 21, 2009 11:03 am

anybody can help me.

Still cant solve my problem
kums
Freshman
Freshman
 
Posts: 8
Joined: Wed Nov 18, 2009 8:50 am

Postby hellshady00 » Fri Dec 25, 2009 11:43 pm

You need to add
Code: Select all
<uses-permission android:name="android.permission.INSTALL_PACKAGES"></uses-permission>


to your AndroidManifest.xml
User avatar
hellshady00
Developer
Developer
 
Posts: 29
Joined: Thu Dec 24, 2009 11:29 pm
Location: Florida

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests