Front-End Web & Mobile
Getting Metadata about the AWS Mobile SDKs
Version 2 of the AWS Mobile SDK
- This article and sample apply to Version 1 of the AWS Mobile SDK. If you are building new apps, we recommend you use Version 2. For details, please visit the AWS Mobile SDK page.
- This content is being maintained for historical reference.
The AWS Mobile SDKs provide functionality to capture details about the environment in which the SDK is executing. These details include SDK version, mobile platform, and platform locale. This information can be useful for diagnosing issues and to help understanding exactly what you are testing/running against.
Retrieving this information is simple. For the AWS SDK for iOS, just include the following line of code in your application and the metadata will be captured in the debug log:
NSLog( @"SDK Details: %@", [AmazonSDKUtil userAgentString] );
The [AmazonSDKUtil userAgentString]
method will output the SDK version along with other device and locale information. The string produced is a concatenation of the systemName and systemIdentifier properties from the current UIDevice and the localeIdentifier from the current NSLocale. The output will be constructed as follows:
“SDK/SDK Version, System Name/System Identifier, Locale Identifier”
An example of the output would look like:
AWS-SDK-IOS/1.4.2 IPHONE-OS/6.0 EN_US
You can capture the same information for the AWS SDK for Android, as follows:
android.util.Log.d( "SDK Details", com.amazonaws.util.VersionInfoUtils.getVersion() );
The com.amazonaws.util.VersionInfoUtils.getVersion()
method will output the SDK version information as well as a number of Java properties. The Java proeprties used to produce the string include: os.name, os.version, java.vm.name, java.vm.version, user.language and user.region. The output string will be contructed as follows:
“SDK/SDK Version, OS Name/OS Version, Java VM Name/Java VM Version, User Language/User Region”
An example of the output would look like:
AWS-SDK-ANDROID/1.3.0 LINUX/2.6.35.7-I9070DXLD1-CL1068093 DALVIK/1.4.0 EN_US
If you need to know the exact version of the AWS Mobile SDK being utilized or what environment/platform version or locale your application is running in, feel free to use the code above to help get you that information. The locale is important since it will affect how numbers and dates are formatted.