Мне нужно получить идентификатор устройства с помощью Secure.getString ()
Я использую контекст
public static String getDeviceId(Context context) {
String currentDeviceId = SharedPreferencesUtil.getCurrentDeviceId();
if (currentDeviceId == null) {
context = Secure.getString(context.getContentResolver(), "android_id");
if (context == null || context.trim().isEmpty() || "9774d56d682e549c".equalsIgnoreCase(context)) {
context = Build.SERIAL;
if (context == null || context.trim().isEmpty() != null) {
context = UUID.randomUUID().toString();
} else {
context = Build.SERIAL;
}
}
if ("unknown".equals(context)) {
context = Build.SERIAL;
if (context == null || context.trim().isEmpty() != null) {
context = UUID.randomUUID().toString();
} else {
context = Build.SERIAL;
}
}
secondDeviceId = context;
Эта строка показывает ошибку ниже
context = Secure.getString(context.getContentResolver(), "android_id");
Несовместимые типы.Требуется: android.content.Context Найдено: java.lang.String