AndroidInfoModule now also returns Android ID

Summary: Added Android ID as one of the constants returned by AndroidInfoModule

Reviewed By: fkgozali

Differential Revision: D7206029

fbshipit-source-id: 110b33235d3023b4a4607d37acc3440cfe735cef
This commit is contained in:
Alexander Tu 2018-03-09 11:57:08 -08:00 committed by Facebook Github Bot
parent 25b8ec81df
commit 216c8ec04b
1 changed files with 2 additions and 0 deletions

View File

@ -10,6 +10,7 @@ package com.facebook.react.modules.systeminfo;
import android.app.UiModeManager; import android.app.UiModeManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.provider.Settings.Secure;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactContextBaseJavaModule;
@ -72,6 +73,7 @@ public class AndroidInfoModule extends ReactContextBaseJavaModule {
constants.put("isTesting", "true".equals(System.getProperty(IS_TESTING))); constants.put("isTesting", "true".equals(System.getProperty(IS_TESTING)));
constants.put("reactNativeVersion", ReactNativeVersion.VERSION); constants.put("reactNativeVersion", ReactNativeVersion.VERSION);
constants.put("uiMode", uiMode()); constants.put("uiMode", uiMode());
constants.put("androidID", Secure.getString(getReactApplicationContext().getContentResolver(), Secure.ANDROID_ID));
return constants; return constants;
} }
} }