You could just stick it in here: https://github.com/googlesamples/android-BluetoothAdvertisements/blob/master/Application/src/main/java/com/example/android/bluetoothadvertisements/ScanResultAdapter.java#L110
That should get called for every new advertising packet that is received.
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You could just stick it in here: https://github.com/googlesamples/android-BluetoothAdvertisements/blob/master/Application/src/main/java/com/example/android/bluetoothadvertisements/ScanResultAdapter.java#L110
That should get called for every new advertising packet that is received.