问题
I am looking for a way to make my Android app
do something every time there is a change in mobile network,
i.e. going from 2g to 3g, 4g to wifi etc.
All I can find for broadcast receivers are the ones that execute on loss or gain of network connection.
回答1:
Have you looked into using a PhoneStateListener? The LISTEN_DATA_CONNECTION_STATE and LISTEN_SERVICE_STATE flags look promising.
来源:https://stackoverflow.com/questions/5518719/broadcast-receiver-to-detect-change-in-mobile-network