File tree Expand file tree Collapse file tree
pingmelive/src/main/java/com/pingmelive/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import android .content .ContentValues ;
44import android .content .Context ;
55import android .content .Intent ;
6+ import android .content .pm .ApplicationInfo ;
67import android .content .pm .PackageInfo ;
78import android .database .Cursor ;
89import android .database .sqlite .SQLiteDatabase ;
@@ -262,7 +263,7 @@ public static String getDatetime(String dateFormat,long milliSeconds) {
262263
263264 public String getMessage (String message )
264265 {
265- return "Version - " +getVersionName (context )+"(" + BuildConfig . VERSION_CODE + " )\n " +message ;
266+ return "Version - " +getVersionName (context )+"( " + getVersionCode ( context )+ " )\n " +message ;
266267 }
267268
268269 public String getDetailedText (String text )
@@ -295,4 +296,10 @@ private String getVersionCode(Context context) {
295296 return "Unknown Version Name" ;
296297 }
297298 }
299+
300+ public static String getApplicationName (Context context ) {
301+ ApplicationInfo applicationInfo = context .getApplicationInfo ();
302+ int stringId = applicationInfo .labelRes ;
303+ return stringId == 0 ? applicationInfo .nonLocalizedLabel .toString () : context .getString (stringId );
304+ }
298305}
You can’t perform that action at this time.
0 commit comments