x1ongzhu 1 سال پیش
والد
کامیت
ba491dcecb

+ 2 - 0
.idea/.gitignore

@@ -1,3 +1,5 @@
 # Default ignored files
 /shelf/
 /workspace.xml
+# GitHub Copilot persisted chat sessions
+/copilot/chatSessions

+ 0 - 1
.idea/misc.xml

@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ExternalStorageConfigurationManager" enabled="true" />
   <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">

+ 7 - 1
app/src/main/java/com/example/mysmsapp/MainActivity.java

@@ -15,6 +15,8 @@ import androidx.core.graphics.Insets;
 import androidx.core.view.ViewCompat;
 import androidx.core.view.WindowInsetsCompat;
 
+import java.io.Serializable;
+
 public class MainActivity extends AppCompatActivity {
     private static final String TAG = "MainActivity";
 
@@ -52,7 +54,11 @@ public class MainActivity extends AppCompatActivity {
         });
 
         findViewById(R.id.btn_pdu).setOnClickListener(e -> {
-            byte[] res = SmsUtils.createFakeSms("15077886171", "test");
+            byte[] res = SmsUtils.createFakeSms("1234", "test");
+            Object[] messages = new Object[1];
+            messages[0] = res;
+            Log.d(TAG, res.toString());
+            Log.d(TAG, messages.toString());
             printPdu(res);
         });
     }

+ 1 - 2
app/src/main/java/com/example/mysmsapp/SmsReceiver.java

@@ -21,14 +21,13 @@ public class SmsReceiver extends BroadcastReceiver {
             String messageBody = message.getMessageBody();
             Log.d(TAG, "onReceive: sender: " + sender + " message: " + messageBody);
             Toast.makeText(context, messageBody, Toast.LENGTH_LONG).show();
-
             Bundle bundle = intent.getExtras();
 
             if (bundle != null) {
                 for (String key : bundle.keySet()) {
                     Object value = bundle.get(key);
                     // 处理每个键值对
-                    Log.d("Bundle", key + ": " + value.toString());
+                    Log.d("Bundle", "key=" + key + ", value=" + value.toString() + ", class=" + value.getClass().getName());
                 }
                 byte[][] pdus = (byte[][]) bundle.get("pdus");
                 MainActivity.printPdu(pdus[0]);