private void updateGAdsParams ( ) { BRANCH_API_VERSION version = getBranchRemoteAPIVersion ( ) ; int LATVal = DeviceInfo . getInstance ( ) . getSystemObserver ( ) . getLATVal ( ) ; String gaid = DeviceInfo . getInstance ( ) . getSystemObserver ( ) . getGAID ( ) ; if ( ! TextUtils . isEmpty ( gaid ) ) { try { if ( version == BRANCH_API_VERSION . V2 ) { JSONObject userDataObj = params_ . optJSONObject ( Defines . Jsonkey . UserData . getKey ( ) ) ; if ( userDataObj != null ) { userDataObj . put ( Defines . Jsonkey . AAID . getKey ( ) , gaid ) ; userDataObj . put ( Defines . Jsonkey . LimitedAdTracking . getKey ( ) , LATVal ) ; userDataObj . remove ( Defines . Jsonkey . UnidentifiedDevice . getKey ( ) ) ; } } else { params_ . put ( Defines . Jsonkey . GoogleAdvertisingID . getKey ( ) , gaid ) ; params_ . put ( Defines . Jsonkey . LATVal . getKey ( ) , LATVal ) ; } } catch ( JSONException e ) { e . printStackTrace ( ) ; } } else { // Add unidentified_device when neither GAID nor AndroidID are present if ( version == BRANCH_API_VERSION . V2 ) { try { if ( version == BRANCH_API_VERSION . V2 ) { JSONObject userDataObj = params_ . optJSONObject ( Defines . Jsonkey . UserData . getKey ( ) ) ; if ( userDataObj != null ) { if ( ! userDataObj . has ( Defines . Jsonkey . AndroidID . getKey ( ) ) ) { userDataObj . put ( Defines . Jsonkey . UnidentifiedDevice . getKey ( ) , true ) ; } } } } catch ( JSONException ignore ) { } } } }
Updates the google ads parameters . This should be called only from a background thread since it involves GADS method invocation using reflection