Compare commits
No commits in common. "48be0900e1909d04b5f05bdacb9500a997d52bfb" and "492cafb51aa351926ebf607e8a2daa5a845a2027" have entirely different histories.
48be0900e1
...
492cafb51a
|
|
@ -2,7 +2,6 @@
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
||||||
<uses-permission android:name="android.permission.ACTION_NOTIFICATION_LISTENER_SETTINGS" />
|
<uses-permission android:name="android.permission.ACTION_NOTIFICATION_LISTENER_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
||||||
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,9 @@ public class HeartbeatAlarmReceiver extends BroadcastReceiver {
|
||||||
*/
|
*/
|
||||||
private <T> Request buildRequest(String apiUrl) {
|
private <T> Request buildRequest(String apiUrl) {
|
||||||
// 从资源文件中读取序列号和访问令牌
|
// 从资源文件中读取序列号和访问令牌
|
||||||
//SN = thisContext.getResources().getString(R.string.SN);
|
// SN = context.getResources().getString(R.string.SN);
|
||||||
SN = DeviceInfoUtils.getAndroidID(thisContext);
|
SN = DeviceInfoUtils.getDeviceSerial();
|
||||||
|
Timber.i("SN: " + SN);
|
||||||
accessToken = thisContext.getResources().getString(R.string.access_token);
|
accessToken = thisContext.getResources().getString(R.string.access_token);
|
||||||
// 创建设备信息对象并设置设备相关属性
|
// 创建设备信息对象并设置设备相关属性
|
||||||
DeviceInfo deviceInfo = new DeviceInfo();
|
DeviceInfo deviceInfo = new DeviceInfo();
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
package com.nbee.echolink.utils;
|
package com.nbee.echolink.utils;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class DeviceInfoUtils {
|
public class DeviceInfoUtils {
|
||||||
/**
|
/**
|
||||||
* 获取设备宽度(px)
|
* 获取设备宽度(px)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public static int getDeviceWidth(Context context) {
|
public static int getDeviceWidth(Context context) {
|
||||||
return context.getResources().getDisplayMetrics().widthPixels;
|
return context.getResources().getDisplayMetrics().widthPixels;
|
||||||
|
|
@ -22,7 +21,6 @@ public class DeviceInfoUtils {
|
||||||
public static int getDeviceHeight(Context context) {
|
public static int getDeviceHeight(Context context) {
|
||||||
return context.getResources().getDisplayMetrics().heightPixels;
|
return context.getResources().getDisplayMetrics().heightPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取厂商名
|
* 获取厂商名
|
||||||
**/
|
**/
|
||||||
|
|
@ -66,6 +64,8 @@ public class DeviceInfoUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
* fingerprit 信息
|
* fingerprit 信息
|
||||||
**/
|
**/
|
||||||
public static String getDeviceFubgerprint() {
|
public static String getDeviceFubgerprint() {
|
||||||
|
|
@ -74,6 +74,7 @@ public class DeviceInfoUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 硬件名
|
* 硬件名
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
public static String getDeviceHardware() {
|
public static String getDeviceHardware() {
|
||||||
return android.os.Build.HARDWARE;
|
return android.os.Build.HARDWARE;
|
||||||
|
|
@ -81,12 +82,14 @@ public class DeviceInfoUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主机
|
* 主机
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
public static String getDeviceHost() {
|
public static String getDeviceHost() {
|
||||||
return android.os.Build.HOST;
|
return android.os.Build.HOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* 显示ID
|
* 显示ID
|
||||||
**/
|
**/
|
||||||
public static String getDeviceDisplay() {
|
public static String getDeviceDisplay() {
|
||||||
|
|
@ -95,24 +98,15 @@ public class DeviceInfoUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID
|
* ID
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
public static String getDeviceId() {
|
public static String getDeviceId() {
|
||||||
return android.os.Build.ID;
|
return android.os.Build.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设备的Android ID。
|
|
||||||
*
|
|
||||||
* @param context 上下文对象,用于访问应用特定的资源和类。
|
|
||||||
* @return 设备唯一的Android ID,是一个64位的十进制字符串。
|
|
||||||
*/
|
|
||||||
public static String getAndroidID(Context context) {
|
|
||||||
// 通过Settings.Secure.getString获取设备的Android ID
|
|
||||||
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取手机用户名
|
* 获取手机用户名
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
public static String getDeviceUser() {
|
public static String getDeviceUser() {
|
||||||
return android.os.Build.USER;
|
return android.os.Build.USER;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue