Moved androidID constant to a method
Summary: androidID was a constant that was exposed as a Platform constant, but it seems to use slightly expensive methods when they need to be computed. Moving this to a method so that it is computed only when needed. Test Plan Reviewed By: ejanzer Differential Revision: D6563853 fbshipit-source-id: 3c5929fcbc947c13c3a25f2bf473e145ac4bf73e
This commit is contained in:
parent
188cbb04ad
commit
9f9390ddfc
|
@ -15,6 +15,7 @@ import android.provider.Settings.Secure;
|
|||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -76,7 +77,11 @@ public class AndroidInfoModule extends ReactContextBaseJavaModule {
|
|||
constants.put("isTesting", "true".equals(System.getProperty(IS_TESTING)));
|
||||
constants.put("reactNativeVersion", ReactNativeVersion.VERSION);
|
||||
constants.put("uiMode", uiMode());
|
||||
constants.put("androidID", Secure.getString(getReactApplicationContext().getContentResolver(), Secure.ANDROID_ID));
|
||||
return constants;
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
public String getAndroidID(){
|
||||
return Secure.getString(getReactApplicationContext().getContentResolver(),Secure.ANDROID_ID);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue