Use the brand new Google Cell Adverts SDK getVersion() methodology
We heard your suggestions that MobileAds.getVersionString() was complicated because it didn’t match the exterior model. We addressed it by including a brand new methodology – MobileAds.getVersion(). In doing so, we have now deprecated MobileAds.getVersionString().
Distinctions between getVersionString() and getVersion()
| getVersionString() [deprecated] | getVersion() | |
|---|---|---|
| Pattern return worth | afma-sdk-a-v214106000.214106000.0
|
21.0.0
|
| Requires calling initialize() first? | Sure | No |
Calling MobileAds.getVersionString() returns an inside model quantity. The MobileAds.getVersion() methodology outputs a simplified, exterior model quantity that matches the model within the launch notes. For instance, 21.0.0.
Additionally as a part of the v21.0.0 launch, you may name MobileAds.getVersion() earlier than calling MobileAds.initialize(). Beforehand, you needed to initialize the SDK to question the SDK model quantity, or else the app would crash.
Querying the SDK model quantity may be achieved in your Android apps with the next code snippet:
// Log the Cell Adverts SDK Model.
Log.d("MyApp", MobileAds.getVersion()); // "21.0.0"
// Initialize the SDK.
MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus standing) {}
});
For the total listing of adjustments within the v21.0.0 launch, verify the launch notes. When you have any questions or want further assist, contact us through the discussion board.