Skip to content

Commit

Permalink
Merge pull request #149 from EdgarJan/master
Browse files Browse the repository at this point in the history
check if labelRes is 0
  • Loading branch information
javiersantos authored Dec 15, 2018
2 parents fa00303 + f3b6280 commit 2ae9e8d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
Expand Down Expand Up @@ -34,7 +35,9 @@
class UtilsLibrary {

static String getAppName(Context context) {
return context.getString(context.getApplicationInfo().labelRes);
ApplicationInfo applicationInfo = context.getApplicationInfo();
int stringId = applicationInfo.labelRes;
return stringId == 0 ? applicationInfo.nonLocalizedLabel.toString() : context.getString(stringId);
}

static String getAppPackageName(Context context) {
Expand Down

0 comments on commit 2ae9e8d

Please sign in to comment.