diff --git a/app/src/debug/ic_launcher-playstore.png b/app/src/debug/ic_launcher-playstore.png
new file mode 100644
index 0000000..c4fcf31
Binary files /dev/null and b/app/src/debug/ic_launcher-playstore.png differ
diff --git a/app/src/debug/res/drawable/ic_launcher_foreground.xml b/app/src/debug/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..ecace5b
--- /dev/null
+++ b/app/src/debug/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
similarity index 65%
rename from app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
rename to app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
index eca70cf..7353dbd 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/app/src/debug/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/app/src/debug/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..56d685d
Binary files /dev/null and b/app/src/debug/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/app/src/debug/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..9429ef1
Binary files /dev/null and b/app/src/debug/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..5127964
Binary files /dev/null and b/app/src/debug/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6928822
Binary files /dev/null and b/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4aa1b7f
Binary files /dev/null and b/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/debug/res/values/ic_launcher_background.xml b/app/src/debug/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..aa673cc
--- /dev/null
+++ b/app/src/debug/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #3F9C8F
+
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 52506e8..480ddef 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -24,7 +24,7 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
- android:roundIcon="@mipmap/ic_launcher_round"
+ android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.EchoLink"
tools:targetApi="29">
diff --git a/app/src/main/ic_launcher-playstore.png b/app/src/main/ic_launcher-playstore.png
new file mode 100644
index 0000000..c4fcf31
Binary files /dev/null and b/app/src/main/ic_launcher-playstore.png differ
diff --git a/app/src/main/java/com/nbee/echolink/MainActivity.java b/app/src/main/java/com/nbee/echolink/MainActivity.java
index fd9c41f..e4ccdc4 100644
--- a/app/src/main/java/com/nbee/echolink/MainActivity.java
+++ b/app/src/main/java/com/nbee/echolink/MainActivity.java
@@ -3,26 +3,31 @@ package com.nbee.echolink;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
-import android.content.IntentFilter;
import android.os.Bundle;
-import android.telephony.TelephonyManager;
-import android.util.Log;
-import android.telephony.PhoneStateListener;
-import android.telephony.TelephonyManager;
-import com.nbee.echolink.broadcast.PhoneCallReceiver;
-import com.nbee.echolink.broadcast.SMSReceiver;
+
import com.nbee.echolink.service.MonitorService;
+import com.nbee.echolink.utils.PermissionUtils;
public class MainActivity extends AppCompatActivity {
private final String TAG = "MainActivity";
-
+ private PermissionUtils permissionUtils;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+
+ permissionUtils = new PermissionUtils(this);
+ permissionUtils.checkPermissions();
+
// 启动MonitorService服务
Intent serviceIntent = new Intent(this, MonitorService.class);
startService(serviceIntent);
}
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ permissionUtils.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/nbee/echolink/utils/DeviceInfoUtils.java b/app/src/main/java/com/nbee/echolink/utils/DeviceInfoUtils.java
index e69de29..c7bd127 100644
--- a/app/src/main/java/com/nbee/echolink/utils/DeviceInfoUtils.java
+++ b/app/src/main/java/com/nbee/echolink/utils/DeviceInfoUtils.java
@@ -0,0 +1,162 @@
+package com.nbee.echolink.utils;
+
+
+import java.util.Locale;
+import android.content.Context;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+
+
+public class DeviceInfoUtils {
+ /**
+ * 获取设备宽度(px)
+ *
+ */
+ public static int getDeviceWidth(Context context) {
+ return context.getResources().getDisplayMetrics().widthPixels;
+ }
+ /**
+ * 获取设备高度(px)
+ */
+ public static int getDeviceHeight(Context context) {
+ return context.getResources().getDisplayMetrics().heightPixels;
+ }
+ /**
+ * 获取设备的唯一标识, 需要 “android.permission.READ_Phone_STATE”权限
+ * Android 10 无法获取此权限
+ */
+// public static String getIMEI(Context context) {
+// TelephonyManager tm = (TelephonyManager) context
+// .getSystemService(Context.TELEPHONY_SERVICE);
+// String deviceId = tm.getDeviceId();
+// if (deviceId == null) {
+// return "UnKnown";
+// } else {
+// return deviceId;
+// }
+// }
+ /**
+ * 获取厂商名
+ * **/
+ public static String getDeviceManufacturer() {
+ return android.os.Build.MANUFACTURER;
+ }
+ /**
+ * 获取产品名
+ * **/
+ public static String getDeviceProduct() {
+ return android.os.Build.PRODUCT;
+ }
+ /**
+ * 获取手机品牌
+ */
+ public static String getDeviceBrand() {
+ return android.os.Build.BRAND;
+ }
+ /**
+ * 获取手机型号
+ */
+ public static String getDeviceModel() {
+ return android.os.Build.MODEL;
+ }
+ /**
+ * 获取手机主板名
+ */
+ public static String getDeviceBoard() {
+ return android.os.Build.BOARD;
+ }
+ /**
+ * 设备名
+ * **/
+ public static String getDeviceDevice() {
+ return android.os.Build.DEVICE;
+ }
+ /**
+ *
+ *
+ * fingerprit 信息
+ * **/
+ public static String getDeviceFubgerprint() {
+ return android.os.Build.FINGERPRINT;
+ }
+ /**
+ * 硬件名
+ *
+ * **/
+ public static String getDeviceHardware() {
+ return android.os.Build.HARDWARE;
+ }
+ /**
+ * 主机
+ *
+ * **/
+ public static String getDeviceHost() {
+ return android.os.Build.HOST;
+ }
+ /**
+ *
+ * 显示ID
+ * **/
+ public static String getDeviceDisplay() {
+ return android.os.Build.DISPLAY;
+ }
+ /**
+ * ID
+ *
+ * **/
+ public static String getDeviceId() {
+ return android.os.Build.ID;
+ }
+ /**
+ * 获取手机用户名
+ *
+ * **/
+ public static String getDeviceUser() {
+ return android.os.Build.USER;
+ }
+ /**
+ * 获取手机 硬件序列号
+ * **/
+ public static String getDeviceSerial() {
+ return android.os.Build.SERIAL;
+ }
+ /**
+ * 获取手机Android 系统SDK
+ *
+ * @return
+ */
+ public static int getDeviceSDK() {
+ return android.os.Build.VERSION.SDK_INT;
+ }
+ /**
+ * 获取手机Android 版本
+ *
+ * @return
+ */
+ public static String getDeviceAndroidVersion() {
+ return android.os.Build.VERSION.RELEASE;
+ }
+ /**
+ * 获取当前手机系统语言。
+ */
+ public static String getDeviceDefaultLanguage() {
+ return Locale.getDefault().getLanguage();
+ }
+ /**
+ * 获取当前系统上的语言列表(Locale列表)
+ */
+ public static String getDeviceSupportLanguage() {
+ Log.e("wangjie", "Local:" + Locale.GERMAN);
+ Log.e("wangjie", "Local:" + Locale.ENGLISH);
+ Log.e("wangjie", "Local:" + Locale.US);
+ Log.e("wangjie", "Local:" + Locale.CHINESE);
+ Log.e("wangjie", "Local:" + Locale.TAIWAN);
+ Log.e("wangjie", "Local:" + Locale.FRANCE);
+ Log.e("wangjie", "Local:" + Locale.FRENCH);
+ Log.e("wangjie", "Local:" + Locale.GERMANY);
+ Log.e("wangjie", "Local:" + Locale.ITALIAN);
+ Log.e("wangjie", "Local:" + Locale.JAPAN);
+ Log.e("wangjie", "Local:" + Locale.JAPANESE);
+ return Locale.getAvailableLocales().toString();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/nbee/echolink/utils/PermissionUtils.java b/app/src/main/java/com/nbee/echolink/utils/PermissionUtils.java
new file mode 100644
index 0000000..f99f225
--- /dev/null
+++ b/app/src/main/java/com/nbee/echolink/utils/PermissionUtils.java
@@ -0,0 +1,79 @@
+package com.nbee.echolink.utils;
+
+import android.Manifest;
+import android.app.Activity;
+import android.content.pm.PackageManager;
+import androidx.core.app.ActivityCompat;
+import androidx.core.content.ContextCompat;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.widget.Toast;
+
+
+public class PermissionUtils {
+ private static final int PERMISSION_REQUEST_CODE = 1;
+ private Activity activity;
+
+ public PermissionUtils(Activity activity) {
+ this.activity = activity;
+ }
+
+ public void checkPermissions() {
+ String[] permissions = {
+ Manifest.permission.READ_PHONE_STATE,
+ Manifest.permission.SEND_SMS,
+ Manifest.permission.READ_CALL_LOG,
+ Manifest.permission.READ_CONTACTS
+ };
+
+ if (!hasPermissions(permissions)) {
+ ActivityCompat.requestPermissions(activity, permissions, PERMISSION_REQUEST_CODE);
+ }
+ }
+
+ private boolean hasPermissions(String... permissions) {
+ for (String permission : permissions) {
+ if (ContextCompat.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
+ if (requestCode == PERMISSION_REQUEST_CODE) {
+ StringBuilder deniedPermissions = new StringBuilder();
+
+ for (int i = 0; i < grantResults.length; i++) {
+ if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
+ if (deniedPermissions.length() > 0) deniedPermissions.append(", ");
+ deniedPermissions.append(permissions[i]);
+ }
+ }
+
+ if (deniedPermissions.length() > 0) {
+ // 显示对话框
+ showAlert("以下权限被拒绝:\n" + deniedPermissions.toString());
+ } else {
+ // 所有请求的权限都被授予
+ // 在这里处理所有权限被授予的情况
+ showToast("已授予运行所需的权限");
+ }
+ }
+ }
+
+ private void showAlert(String message) {
+ new AlertDialog.Builder(activity)
+ .setMessage(message)
+ .setPositiveButton("确认", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ })
+ .create()
+ .show();
+ }
+ private void showToast(String message) {
+ Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
+ }
+}
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
deleted file mode 100644
index 2b068d1..0000000
--- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
index 07d5da9..0795166 100644
--- a/app/src/main/res/drawable/ic_launcher_background.xml
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -1,4 +1,3 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index eca70cf..0000000
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..23cba59
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
deleted file mode 100644
index c209e78..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index b2dfe3d..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-ldpi/ic_launcher.png b/app/src/main/res/mipmap-ldpi/ic_launcher.png
new file mode 100644
index 0000000..c7d212b
Binary files /dev/null and b/app/src/main/res/mipmap-ldpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..eb99c0f
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
deleted file mode 100644
index 4f0f1d6..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
deleted file mode 100644
index 62b611d..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..ba78e52
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
deleted file mode 100644
index 948a307..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
deleted file mode 100644
index 1b9a695..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..d591572
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
deleted file mode 100644
index 28d4b77..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9287f50..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..52bca53
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
deleted file mode 100644
index aa7d642..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9126ae3..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/playstore-icon.png b/app/src/main/res/playstore-icon.png
new file mode 100644
index 0000000..ad632f0
Binary files /dev/null and b/app/src/main/res/playstore-icon.png differ
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..aa673cc
--- /dev/null
+++ b/app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #3F9C8F
+
\ No newline at end of file