← 목록

Confirming bank transfers from Android notifications with 15 lines of Python

devto 2026-10-10 원문 보기 ↗


Small shops that take bank transfers usually confirm them by hand: the bank app shows "deposit received", someone opens the order list and marks the order paid. Banks do offer APIs for this, but they come with contracts and fees that a small shop doesn't want.

The phone already gets the information for free, as a notification. So I wired the notification straight into code.

The setup

I used Droidline, an open source tool I've been building. It has two parts:

There's no ADB, no USB debugging and no root. You pair the phone once by scanning a QR code from droidline pair.

The code

The same two steps in every language: tell the phone which app's notifications to forward, then react to each one.

Python

from droidline import connect

d = connect("s23")
d.notify_filter(["com.example.bank"])   # only pass this app's notifications to the PC

def paid(n):
    if n["text"].startswith("[Deposit]"):
        mark_paid(n["text"])            # your own order system

d.on_notification(callback=paid)
input()

Node.js

import { connect } from "droidline";

const d = await connect("s23");
await d.notifyFilter(["com.example.bank"]);

await d.onNotification({ package: "com.example.bank" }, (n) => {
  if (n.text.startsWith("[Deposit]")) markPaid(n.text);
});

C

using Droidline;

await using var d = await DroidlineClient.ConnectAsync("s23");
await d.NotifyFilterAsync(new[] { "com.example.bank" });

using var stop = await d.OnNotificationAsync(n =>
{
    if (n.Text.StartsWith("[Deposit]")) MarkPaid(n.Text);
}, package: "com.example.bank");

Console.ReadLine();

Shell

droidline notify_filter com.example.bank
droidline on_notification --package com.example.bank

The second command prints each notification as a JSON line until you stop it, so you can pipe it into anything.

notify_filter matters: by default nothing leaves the phone, and you choose which apps' notifications are forwarded. Replace com.example.bank with your bank app's package name, and the [Deposit] check with your bank's wording, since every bank phrases the notification differently. mark_paid stands for your own order system.

Install: pip install droidline, npm install droidline or dotnet add package Droidline. The droidline command and the Android app are on the releases page.

Things to know

Beyond notifications

The same connection can tap, type, swipe, take screenshots and run OCR, and there's an MCP server so AI agents can use the phone. On a Galaxy S23 Ultra, finding an element by its text takes 16 ms (median of 10 runs), against 100 ms for Appium UiAutomator2 and 2,368 ms for adb plus uiautomator. The benchmark script is in the repo under scripts/bench.

I wrote this post with help from an AI assistant and checked every command against the project.