R RJB Active Member Licensed User Longtime User Jan 30, 2016 #1 I've spent a few days trying to get wifidirect to work without much luck. I'm using android 4.4.2 for testing and there seems to be a built in 'wifidirect manager' permanently running. Occasionally an 'Invitation to connect' pops up. Is there a conflict here? If so is there any way to turn off the built in 'manager' to avoid it? (The 'search for devices' entry in the Wi-Fi Direct menu seems to lock permanently on 'searchin...' or at least stays on for a very long time with no way of cancelling it, if that has any bearing on the problem).
I've spent a few days trying to get wifidirect to work without much luck. I'm using android 4.4.2 for testing and there seems to be a built in 'wifidirect manager' permanently running. Occasionally an 'Invitation to connect' pops up. Is there a conflict here? If so is there any way to turn off the built in 'manager' to avoid it? (The 'search for devices' entry in the Wi-Fi Direct menu seems to lock permanently on 'searchin...' or at least stays on for a very long time with no way of cancelling it, if that has any bearing on the problem).
Erel B4X founder Staff member Licensed User Longtime User Jan 31, 2016 #2 Which device are you using? Upvote 0
R RJB Active Member Licensed User Longtime User Jan 31, 2016 #3 A generic phone/tablet and an M8 android TV box. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 31, 2016 #4 This wifi manager is not part of the standard Android. Maybe this device manufacturer has added this software. Upvote 0
This wifi manager is not part of the standard Android. Maybe this device manufacturer has added this software.
R RJB Active Member Licensed User Longtime User Jan 31, 2016 #5 That may be the case but I have checked on another four devices and they all have the same menu/ submenu in the wifi setup and all work in exactly the same way so it seem a bit strange. I presume all six devices are from different manufacturers. The additional four are: an MX TV box running 4.2.2, a CX919 'stick' running 4.2.2, another generic 'stick' running 4.4.2 and a phone running 4.2.2. Upvote 0
That may be the case but I have checked on another four devices and they all have the same menu/ submenu in the wifi setup and all work in exactly the same way so it seem a bit strange. I presume all six devices are from different manufacturers. The additional four are: an MX TV box running 4.2.2, a CX919 'stick' running 4.2.2, another generic 'stick' running 4.4.2 and a phone running 4.2.2.
Erel B4X founder Staff member Licensed User Longtime User Feb 1, 2016 #6 Are you running this example: https://www.b4x.com/android/forum/threads/android-wifi-direct-tutorial.30409/ ? Can you post a screenshot with this dialog? Upvote 0
Are you running this example: https://www.b4x.com/android/forum/threads/android-wifi-direct-tutorial.30409/ ? Can you post a screenshot with this dialog?
R RJB Active Member Licensed User Longtime User Feb 1, 2016 #7 I wasn't, but I have run it and the screenshots are attached showing the menus and dialogue: Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Feb 1, 2016 #8 These settings have nothing to do with the usage of wifi direct. You need to go over that tutorial. Upvote 0
R RJB Active Member Licensed User Longtime User Feb 1, 2016 #9 Sorry but I don't understand. The wi-fidirect settings and the 'Invitation to connect', that pops up when you try to connect, have nothing to do with wifi direct? Am I missing something? Upvote 0
Sorry but I don't understand. The wi-fidirect settings and the 'Invitation to connect', that pops up when you try to connect, have nothing to do with wifi direct? Am I missing something?
Erel B4X founder Staff member Licensed User Longtime User Feb 1, 2016 #10 It has nothing to do with using wifi direct in your app. Follow the tutorial it explains the steps required. Upvote 0
It has nothing to do with using wifi direct in your app. Follow the tutorial it explains the steps required.
R RJB Active Member Licensed User Longtime User Feb 2, 2016 #11 OK, a final question and an observation then: Question: Can you tell me what 'connected' indicates in the '_ConnectionChanged' event? i.e. when it is raised by .initiliaize, .connect, etc.? Observation: Using the example from the tutorial (which I presume follows the steps given) and run it on two devices. Unknown to us a third device within wifi range is searching from its built-in wi-fidirect. Press 'discover' on both of our devices and they immediately show 'Peered Devices: 1'. Press 'connect' on one of them before it discovers our second device and it tries to connect to the third, unknown to us, device. That device now shows the 'Invitation to connect' prompt. So presumably we have to know in advance the name of the device we are trying to connect to so that we can search the 'devices' list and only try to connect if we find it. Upvote 0
OK, a final question and an observation then: Question: Can you tell me what 'connected' indicates in the '_ConnectionChanged' event? i.e. when it is raised by .initiliaize, .connect, etc.? Observation: Using the example from the tutorial (which I presume follows the steps given) and run it on two devices. Unknown to us a third device within wifi range is searching from its built-in wi-fidirect. Press 'discover' on both of our devices and they immediately show 'Peered Devices: 1'. Press 'connect' on one of them before it discovers our second device and it tries to connect to the third, unknown to us, device. That device now shows the 'Invitation to connect' prompt. So presumably we have to know in advance the name of the device we are trying to connect to so that we can search the 'devices' list and only try to connect if we find it.
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2016 #12 The ConnectionChanged event is raised after you call Connect or Connect2. If the Connection parameter is true then the connection was established successfully. Otherwise it means that it failed to connect (or that a successful connection has broken). Upvote 0
The ConnectionChanged event is raised after you call Connect or Connect2. If the Connection parameter is true then the connection was established successfully. Otherwise it means that it failed to connect (or that a successful connection has broken).
R RJB Active Member Licensed User Longtime User Feb 2, 2016 #13 Thanks Just to check my understanding: on '.intitiatize' _EnabledChanged is called with 'enabled' true, AND _ConnectionChanged is called with 'connected' false on '.connect' _ConnectionChanged is called with 'connected' true if successful and false otherwise if an existing, successful connection breaks then _ConnectionChanged is called with 'connected' = false and you should re-establish the connection as it won't automatically re-connect. on '.GetCurrentStatus' _ConnectionChanged and _EnabledChanged are both called, with 'enabled' and 'connected' set accordingly. Is the source for the wificonnect library available - it might clarify what's happening? Thanks again Upvote 0
Thanks Just to check my understanding: on '.intitiatize' _EnabledChanged is called with 'enabled' true, AND _ConnectionChanged is called with 'connected' false on '.connect' _ConnectionChanged is called with 'connected' true if successful and false otherwise if an existing, successful connection breaks then _ConnectionChanged is called with 'connected' = false and you should re-establish the connection as it won't automatically re-connect. on '.GetCurrentStatus' _ConnectionChanged and _EnabledChanged are both called, with 'enabled' and 'connected' set accordingly. Is the source for the wificonnect library available - it might clarify what's happening? Thanks again
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2016 #14 That's correct. I'm sorry but the library source code is not available. Upvote 0
R RJB Active Member Licensed User Longtime User Feb 3, 2016 #16 Final notes: 1. I personally think there is a conflict which causes erratic behaviour in wifidirect under some circumstances. This may account for some people noting that wifidirect is unreliable. I can't prove it without being able to turn off the built in 'wifi direct manager'. I'll have to find another way to do what I wanted to do. 2. It might be obvious but possibly worth pointing out: in _PeersDiscovered, 'Devices As List' is not initialised unless 'success' is true. 3. Its a real pain that logging doesn't work any more and a shame that bookmarks aren't available. Upvote 0
Final notes: 1. I personally think there is a conflict which causes erratic behaviour in wifidirect under some circumstances. This may account for some people noting that wifidirect is unreliable. I can't prove it without being able to turn off the built in 'wifi direct manager'. I'll have to find another way to do what I wanted to do. 2. It might be obvious but possibly worth pointing out: in _PeersDiscovered, 'Devices As List' is not initialised unless 'success' is true. 3. Its a real pain that logging doesn't work any more and a shame that bookmarks aren't available.
Erel B4X founder Staff member Licensed User Longtime User Feb 3, 2016 #17 Logging should work. If you are using B4A-Bridge then it will only work in debug mode. Upvote 0
R RJB Active Member Licensed User Longtime User Feb 3, 2016 #18 I thought I read somewhere that Google had made changes that meant that logging would no longer work? Via wireless and B4a-Bridge, in debug mode the following: Code: Copy Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") Log("test") End Sub Sub Activity_Resume Log("test") Msgbox("OK","") End Sub just brings up the messagebox and the only thing in the log is "LogCat connected to: B4A-Bridge: Jlinksz MT13" B4a version 5.50 Upvote 0
I thought I read somewhere that Google had made changes that meant that logging would no longer work? Via wireless and B4a-Bridge, in debug mode the following: Code: Copy Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: 'Activity.LoadLayout("Layout1") Log("test") End Sub Sub Activity_Resume Log("test") Msgbox("OK","") End Sub just brings up the messagebox and the only thing in the log is "LogCat connected to: B4A-Bridge: Jlinksz MT13" B4a version 5.50
Erel B4X founder Staff member Licensed User Longtime User Feb 3, 2016 #19 The change is explained here: https://www.b4x.com/android/forum/posts/211139/ If it doesn't work for you then you should switch to USB debug mode, which always works. Upvote 0
The change is explained here: https://www.b4x.com/android/forum/posts/211139/ If it doesn't work for you then you should switch to USB debug mode, which always works.
R RJB Active Member Licensed User Longtime User Feb 3, 2016 #20 The 'problem' with logging was my fault. On one device I hadn't enabled 'USB Debugging' and on another I had an old version of the B4A-Bridge!! Upvote 0
The 'problem' with logging was my fault. On one device I hadn't enabled 'USB Debugging' and on another I had an old version of the B4A-Bridge!!