Don't crash on startup if NFC is not available
This commit is contained in:
parent
6b2b759a16
commit
4e26c77327
@ -423,17 +423,19 @@ public class FDroid extends FragmentActivity {
|
|||||||
private void setupAndroidBeam() {
|
private void setupAndroidBeam() {
|
||||||
PackageManager pm = getPackageManager();
|
PackageManager pm = getPackageManager();
|
||||||
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
|
||||||
ApplicationInfo appInfo;
|
if (nfcAdapter != null) {
|
||||||
try {
|
ApplicationInfo appInfo;
|
||||||
appInfo = pm.getApplicationInfo("org.fdroid.fdroid",
|
try {
|
||||||
PackageManager.GET_META_DATA);
|
appInfo = pm.getApplicationInfo("org.fdroid.fdroid",
|
||||||
// TODO can we send the repo here also, as a file?
|
PackageManager.GET_META_DATA);
|
||||||
Uri uris[] = {
|
// TODO can we send the repo here also, as a file?
|
||||||
Uri.parse("file://" + appInfo.publicSourceDir),
|
Uri uris[] = {
|
||||||
};
|
Uri.parse("file://" + appInfo.publicSourceDir),
|
||||||
nfcAdapter.setBeamPushUris(uris, this);
|
};
|
||||||
} catch (NameNotFoundException e1) {
|
nfcAdapter.setBeamPushUris(uris, this);
|
||||||
e1.printStackTrace();
|
} catch (NameNotFoundException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user