don't show notification if the app name is unknown #720

This gets rid of the notifications that say "Tap to Install Unknown", and
instead just cancels the notification.  The downloaded APK will still be
cached, so when the user goes to click install or update again, it won't
need to download it again.

closes #758
This commit is contained in:
Hans-Christoph Steiner 2016-09-01 15:49:15 +02:00
parent c9a6cc3051
commit 530144bec6

View File

@ -331,7 +331,12 @@ public class InstallManagerService extends Service {
title = String.format(getString(R.string.tap_to_update_format),
pm.getApplicationLabel(pm.getApplicationInfo(apk.packageName, 0)));
} catch (PackageManager.NameNotFoundException e) {
title = String.format(getString(R.string.tap_to_install_format), getAppName(apk));
// TODO use packageName to fetch App instance from database if not cached
String name = getAppName(apk);
if (TextUtils.isEmpty(name) || name.equals(new App().name)) {
return; // do not have a name to display, so leave notification as is
}
title = String.format(getString(R.string.tap_to_install_format), name);
}
int downloadUrlId = urlString.hashCode();