mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
安卓设备码 (#228)
修复安卓不可读取设备码的bug --------- Co-authored-by: Ho-spair <linyuy@163.com>
This commit is contained in:
parent
c86c13cf20
commit
738332db2d
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package org.notify.FreeKill;
|
package org.notify.FreeKill;
|
||||||
|
|
||||||
|
import android.provider.Settings;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
@ -43,4 +44,12 @@ public class Helper {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String GetSerial() {
|
||||||
|
Activity activity = QtNative.activity();
|
||||||
|
return Settings.Secure.getString(
|
||||||
|
activity.getContentResolver(),
|
||||||
|
Settings.Secure.ANDROID_ID
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,12 @@ QJsonDocument String2Json(const QString &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GetDeviceUuid() {
|
QString GetDeviceUuid() {
|
||||||
|
#ifdef Q_OS_ANDROID
|
||||||
|
QJniObject string = QJniObject::callStaticObjectMethod("org/notify/FreeKill/Helper", "GetSerial", "()Ljava/lang/String;");
|
||||||
|
return string.toString();
|
||||||
|
#else
|
||||||
return QSysInfo::machineUniqueId();
|
return QSysInfo::machineUniqueId();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Color(const QString &raw, fkShell::TextColor color,
|
QString Color(const QString &raw, fkShell::TextColor color,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user