Get a broadcast to android app on connection made

A question about registering BLE notification on android:
I am using espruino firmware on a ruuvi-tag.
Trying to understand, on the android app side how can I register some intentservice to be called when a ble connection was made to the android framework.

Just a note: a broadcast receiver registered in manifest can no longer launch your app. android background services policy was changed, and since api M (I think) this can’t be done. so

I am trying to use JobScheduler which was designed to be launched based on criteria. this can launch a JobService to do the job.

When the app is in foreground or background this seems to be working.
The thing is, I need to be notified when the app is not running (Not even in background)


Are you trying to establish a GATT connection or trigger an event when advertisement is detected? If you’re trying to trigger an event, please see Ruuvi Station sources available on Ruuvi GitHub.

1 Like

Thanks for the info. I guess it’s a combination of the two (trigger and GATT).
I am trying to trigger that once beacon is detected, the app will be triggered.
This trigger will cause the app to write a value (let’s say 0 or 1) to a specific GPIO in the ruuvi-tag.
And again, the app should be triggered even if it is NOT running.

Hello, maybe @fs or @io53 could give you some pointers? I’m not too familiar with the Android development myself

1 Like

@fs or @io53 any help would be appreciated. thanks a lot