@@ -32,15 +32,10 @@ public string SDKName {
3232 }
3333 }
3434
35+ private string appName ;
3536 public string AppName {
3637 get {
37- // Unity 5 has `Application.productName`, but will compile error in earlier version.
38- // Reflection is the best way we can do for now.
39- PropertyInfo property = typeof ( Application ) . GetProperty ( "productName" ) ;
40- if ( property != null ) {
41- return ( string ) property . GetValue ( null , null ) ;
42- }
43- return null ;
38+ return appName ;
4439 }
4540 }
4641
@@ -51,15 +46,10 @@ public string AppBuildVersion {
5146 }
5247 }
5348
49+ private string appDisplayVersion ;
5450 public string AppDisplayVersion {
5551 get {
56- // Unity 5 has `Application.bundleIdentifier`, but will compile error in earlier version.
57- // Reflection is the best way we can do for now.
58- PropertyInfo property = typeof ( Application ) . GetProperty ( "bundleIdentifier" ) ;
59- if ( property != null ) {
60- return ( string ) property . GetValue ( null , null ) ;
61- }
62- return null ;
52+ return appDisplayVersion ;
6353 }
6454 }
6555
@@ -1215,9 +1205,23 @@ public void Initialize() {
12151205 osVersion = SystemInfo . deviceModel ;
12161206 // Unity 5 has `Application.version`, but will compile-error in earlier version.
12171207 // Reflection is the best way we can do for now.
1218- PropertyInfo property = typeof ( Application ) . GetProperty ( "version" ) ;
1219- if ( property != null ) {
1220- appBuildVersion = ( string ) property . GetValue ( null , null ) ;
1208+ PropertyInfo appVersionProp = typeof ( Application ) . GetProperty ( "version" ) ;
1209+ if ( appVersionProp != null ) {
1210+ appBuildVersion = ( string ) appVersionProp . GetValue ( null , null ) ;
1211+ }
1212+
1213+ // Unity 5 has `Application.bundleIdentifier`, but will compile error in earlier version.
1214+ // Reflection is the best way we can do for now.
1215+ PropertyInfo bundleIdProp = typeof ( Application ) . GetProperty ( "bundleIdentifier" ) ;
1216+ if ( bundleIdProp != null ) {
1217+ appDisplayVersion = ( string ) bundleIdProp . GetValue ( null , null ) ;
1218+ }
1219+
1220+ // Unity 5 has `Application.productName`, but will compile error in earlier version.
1221+ // Reflection is the best way we can do for now.
1222+ PropertyInfo productNameProp = typeof ( Application ) . GetProperty ( "productName" ) ;
1223+ if ( productNameProp != null ) {
1224+ appName = ( string ) productNameProp . GetValue ( null , null ) ;
12211225 }
12221226
12231227 settings = SettingsWrapper . Wrapper ;
0 commit comments