Issue
I'm downloading from a FTP server an .apk file to update my application. My relevant code is:
Intent intent = new Intent(Intent.ACTION_VIEW);
File file = new File(context.getFilesDir() + "/" + filename);
if (file.exists()) {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
When the intent is launched (in the last line, context.startActivity(intent);
) it just say that there has been an error analyzing the package (or something like that, I'm not sure how the message is in english). The .apk has been signed.
I have not a single clue about what's wrong, any idea?
Solution
The installer process cannot access files on internal storage of your app. And, since last I checked, you cannot install from a ContentProvider
, you will have to move the file to some location on external storage.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.