Get rid of EXTRA_NOT_UNKNOWN_SOURCE target api warning
This commit is contained in:
parent
2cd17a904e
commit
9f2de0abd7
@ -29,6 +29,7 @@ import android.widget.*;
|
|||||||
import org.fdroid.fdroid.data.*;
|
import org.fdroid.fdroid.data.*;
|
||||||
import org.xml.sax.XMLReader;
|
import org.xml.sax.XMLReader;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
@ -912,13 +913,19 @@ public class AppDetails extends ListActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TargetApi(14)
|
||||||
|
private void extraNotUnknownSource(Intent intent) {
|
||||||
|
if (Build.VERSION.SDK_INT < 14) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
|
||||||
|
}
|
||||||
|
|
||||||
private void installApk(File file, String id) {
|
private void installApk(File file, String id) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(Uri.parse("file://" + file.getPath()),
|
intent.setDataAndType(Uri.parse("file://" + file.getPath()),
|
||||||
"application/vnd.android.package-archive");
|
"application/vnd.android.package-archive");
|
||||||
if (Build.VERSION.SDK_INT >= 14) {
|
extraNotUnknownSource(intent);
|
||||||
intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
|
|
||||||
}
|
|
||||||
startActivityForResult(intent, REQUEST_INSTALL);
|
startActivityForResult(intent, REQUEST_INSTALL);
|
||||||
((FDroidApp) getApplication()).invalidateApp(id);
|
((FDroidApp) getApplication()).invalidateApp(id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user