0

I am working on providing automatic updates to my application. I am able to connect to our FTP server, download the apk and invoke the Android package installer. I have other steps listed after the installation process, like deleting the downloaded apk..etc. But once I invoke the Android Package installer my current thread exits throwing the following message:

"Not granting permission android:permission.INSTALL_PACKAGES to package.com.csg.android (protectionLevel =3 flags=0x8be46)"

I need help in resolving this problem that I am having. Reasons this is occuring and the way around to deal with them?

Any help is greatly appreciated.

Thanks, Navin

EDIT:

After reading through initial comments I got for my post, I thought I will clarify the question once again and add the code that I am using.

here is the code`

    File file = new File(getFilesDir(), filename);

    Intent intent = new Intent(Intent.ACTION_VIEW);

    intent.setDataAndType(Uri.fromFile(file),
            "application/vnd.android.package-archive");


    startActivity(intent);   

            deleteFiles();

`

And yes, I also added the uses-permission tag for the INSTALL_PACKAGES.

As I said in my original post, I am able to invoke the Package installer and I am getting the install prompts and the installation process goes through successfully. But the problem I have is with the steps after the installation that I coded..i.e the execution of the function deleteFiles();

My thread gets terminated performing startActivity(intent), which I suppose handles the control to package Installer and invokes the installation process. When I checked the logcat log file to see what made the thread terminate, I found the message that I posted above about the protectionLevel. I hope I am clear now. Help is appreciated.

And yes I did search for this protectionLevel issue in other posts and I didn't find any info about that.

Thanks, NavinC

NavinC
  • 233
  • 1
  • 7
  • 14
  • please try to search fisrt until ask ok – PedroAGSantos May 20 '11 at 16:42
  • @NavinC: I have no idea how you are trying to "invoke the Android package installer". If you use the technique that @subspider references in his link, it should work fine. If you are trying to install an update without user knowledge by bypassing the standard `ACTION_VIEW` technique, that will not work. – CommonsWare May 20 '11 at 16:43
  • @CommonsWare: thanks for your reply. I updated my post with more information about the problem and the code that i am using. – NavinC May 20 '11 at 17:04
  • @NavinC: So, let me get this straight -- you have a problem in `deleteFiles()`, yet you do not supply the stack trace associated with that "problem" (and, no, the protection level stuff is not a stack trace), nor do you provide the source to `deleteFiles()`. I am not quite certain how you expect anyone to help you. – CommonsWare May 20 '11 at 17:15
  • @CommonsWare: No, the thread is terminating evenbefore it starts executing deleteFiles(); i.e after my application passes control to the package Installer, which is by startActivity(intent); – NavinC May 20 '11 at 17:22
  • Try emailing an .apk to yourself or browsing to one on the sdcard with a good file manager - if you can't install that way, something may be wrong outside of your program. Do you have device which permits enabling non-market sources? – Chris Stratton May 20 '11 at 17:30

1 Answers1

0

Did you add <uses-permission android:name="android.permission.INSTALL_PACKAGES"/> to the manifest?

Ted Hopp
  • 227,407
  • 48
  • 383
  • 507
  • Even if the OP did, that is not a permission that SDK applications can be granted. In fact, I suspect that the error message comes from having the element you cite in the manifest, though I haven't tried it. – CommonsWare May 20 '11 at 16:44
  • Thanks for you reply Ted. I updated the post with some additional information. – NavinC May 20 '11 at 17:06