Best way to notify of cell replacement on Android?

I'm trying to get a notification when my phone switches to another cell. To do this, I registered the listener in TelephonyManager and got information about all cells using the OnCellInfoChanged and OnSignalStrenghChanged (since OnCellInfoChanged always gives me null as a CellInfo list, when OnSignalStrenghChanged is OnSignalStrenghChanged I call the getAllCellInfo method from TelephonyManager , so it does)

Since this listener is called only when the phone is not sleeping (cf How to detect tower changes in Android? ), I am not always notified from the cell tower change.

I do not want to create a long-term service or check at a specific interval at which I use a cell of cells.

Do you know any method for notifying when a user is on a cell tower (for example, even when the phone is sleeping)?

What I want to achieve is to notify the user when he is close to a specific cell in the tower.

+5
source share

Source: https://habr.com/ru/post/1200413/


All Articles