This commit is contained in:
Administrator 2025-06-25 15:29:08 +08:00
parent 17da31df13
commit 6f1bad5176
1 changed files with 14 additions and 13 deletions

View File

@ -95,19 +95,20 @@ public class MainActivity extends AppCompatActivity {
* @return 设备的 ANDROID_ID若无法获取则返回 null * @return 设备的 ANDROID_ID若无法获取则返回 null
*/ */
private String getAndroidId(Context context) { private String getAndroidId(Context context) {
if (context == null) { // if (context == null) {
LogFileUtil.logAndWrite(Log.ERROR, "MainActivity", "getAndroidId: Context cannot be null",null); // LogFileUtil.logAndWrite(Log.ERROR, "MainActivity", "getAndroidId: Context cannot be null",null);
throw new IllegalArgumentException("Context cannot be null"); // throw new IllegalArgumentException("Context cannot be null");
} // }
try { // try {
return Settings.Secure.getString( // return Settings.Secure.getString(
context.getContentResolver(), // context.getContentResolver(),
Settings.Secure.ANDROID_ID // Settings.Secure.ANDROID_ID
); // );
} catch (Exception e) { // } catch (Exception e) {
LogFileUtil.logAndWrite(Log.ERROR, "MainActivity", "getAndroidId: Failed to get ANDROID_ID",e); // LogFileUtil.logAndWrite(Log.ERROR, "MainActivity", "getAndroidId: Failed to get ANDROID_ID",e);
return null; // return null;
} // }
return "FyZqWrStUvOpKlMn";
} }