Bonjour
I would like to create a simple market applications for android but I face a annoying issue.
The install flow is as below:
1- Download of apk file in the application context :
InputStream input = new BufferedInputStream(url.openStream()) ;
OutputStream output = openFileOutput("xx.apk", Activity.MODE_WORLD_READABLE);
byte data[] = new byte[1024];
while ((count = input.read(data)) != -1 && statusDownload ) {
output.write(data, 0, count);
}
output.flush();
output.close();
input.close();
2- When download is finished:
promptInstall = new Intent(Intent.ACTION_VIEW);
File fileApk = new File (getFilesDir() + "/xx.apk");
promptInstall.setDataAndType(Uri.fromFile(fileApk) , Consts.APK_FILE_INSTALL_TYPE);
startActivityForResult(promptInstall,654);
3- After installing (or if cancelled), apk file is deleted:
File fileApk = new File (a.getFilesDir() + "/xx.apk" );
fileApk.delete();
In order to install an apk file, it must be "World Readable", it means that everyone can , after downloading the file (and before installing), get the apk file.
Does anyone know how to set good permissions for avoid external downloads ?
Thank you for reading !