giggetto71 Active Member Licensed User Longtime User May 26, 2022 #1 Hi, I am facing a very strange issue on some phones. apparently when I disable the wifi and phone switches from wifi -> mobile data the event fires, but when I re-enable the wifi the connectivityChanged does not fire (it's almost like the switch between mobile data->wifi, that happens "so fast" (or so smooth..) that the even does not detect a change in connectivity...again what puzzles me is that this seems to happen only on some phones (maybe android version? maybe some network settings..). thanks for any tips.
Hi, I am facing a very strange issue on some phones. apparently when I disable the wifi and phone switches from wifi -> mobile data the event fires, but when I re-enable the wifi the connectivityChanged does not fire (it's almost like the switch between mobile data->wifi, that happens "so fast" (or so smooth..) that the even does not detect a change in connectivity...again what puzzles me is that this seems to happen only on some phones (maybe android version? maybe some network settings..). thanks for any tips.
giggetto71 Active Member Licensed User Longtime User May 27, 2022 #2 Hi, I have just noticed that I was using: B4X: Copy PhoneEvent1.Initialize("PhoneEvent") and not B4X: Copy Public PhoneId As PhoneId '................' PhoneEvent1.InitializeWithPhoneState("PhoneEvent",PhoneId) what is the difference between the two intialization methods? thanks Upvote 0
Hi, I have just noticed that I was using: B4X: Copy PhoneEvent1.Initialize("PhoneEvent") and not B4X: Copy Public PhoneId As PhoneId '................' PhoneEvent1.InitializeWithPhoneState("PhoneEvent",PhoneId) what is the difference between the two intialization methods? thanks
Erel B4X founder Staff member Licensed User Longtime User May 29, 2022 #3 You should use Initialize. InitializeWithPhoneState add the (mostly) no longer relevant PhoneStateChanged event. Upvote 0
You should use Initialize. InitializeWithPhoneState add the (mostly) no longer relevant PhoneStateChanged event.
giggetto71 Active Member Licensed User Longtime User May 29, 2022 #4 Thanks. I am not sure i understand the meaning of "no longer relevant". Is there another way to be notified in the application about connection state change? Upvote 0
Thanks. I am not sure i understand the meaning of "no longer relevant". Is there another way to be notified in the application about connection state change?
Erel B4X founder Staff member Licensed User Longtime User May 29, 2022 #5 PhoneState has nothing to do with ConnectivityChanged. The problem is somewhere else. You can use a timer and check ServerSocket.GetMyWifiIp: https://www.b4x.com/android/forum/threads/utility-code-getwifiname.26174/post-151601 Upvote 0
PhoneState has nothing to do with ConnectivityChanged. The problem is somewhere else. You can use a timer and check ServerSocket.GetMyWifiIp: https://www.b4x.com/android/forum/threads/utility-code-getwifiname.26174/post-151601
giggetto71 Active Member Licensed User Longtime User May 29, 2022 #6 I would prefer an event to a timer as the app is a foregroud service and I want to save battery as much as possible. My only problem is that on some phones the event seems to fire only wifi ->4g while it seems to just skip in case of 4g->wifi. Unfortunately one of those phones is my company phone where most settings are administered by my company and i cannot install apps from unkown sources..only from google play..so on that phone i cannot make tests..only when the app is released...:-(.. Upvote 0
I would prefer an event to a timer as the app is a foregroud service and I want to save battery as much as possible. My only problem is that on some phones the event seems to fire only wifi ->4g while it seems to just skip in case of 4g->wifi. Unfortunately one of those phones is my company phone where most settings are administered by my company and i cannot install apps from unkown sources..only from google play..so on that phone i cannot make tests..only when the app is released...:-(..