Android Question Problem with WIFI Direct

William Hunter

Active Member
Licensed User
Longtime User
I am working on an app to transfer files using WIFI Direct. I’m having a problem trying to log errors, because when I enable WIFI Direct on my test devices, I cannot use a WIFI connection in order to work with B4A Bridge. I’m flying blind.

I’m posting my project in the hope that someone more knowledgeable than I will review my code to see if I have made an obvious coding error. Most of the code has been taken from a few of Erel’s tutorial samples, to which I have added additional code of my own. I have gone over this project many times, and nothing seems amiss.

I have no problem connecting the two devices, or in selecting a file for transfer. The two problems I have are listed below:

1. When the transferred file is saved on the receiving device it is assigned a file name that is numeric, not the original file name and extension. The file content is correct.

2. On the receiving device, when the file transfer is completed, my app (WIFI Direct) shuts down showing this message – “Unfortunately, WIFI Direct has stopped working”.

Any help with this would be greatly appreciated.

Best regards
 

Attachments

  • WifiDirect.zip
    58.6 KB · Views: 184
Last edited:

William Hunter

Active Member
Licensed User
Longtime User
Thank you Erel - I have found B4A Bridge to be such a convenient tool, it has become my goto tool for testing. I had virtually forgotten about USB Debugging.

Using USB Debugging I found two simple single character typos that were the culprits. I hope that is all. I still have a problem in that I can transfer files flawlessly from a device running Android v-4.0.4 to another running v-4.1.2. When I reverse devices to send from the device running v-4.1.2 to the other running v-4.0.4 my app stops running, with the same app has stopped running message, on the receiving device (v-4.0.4). To make matters worse, no matter how I try, I cannot seem to set up USB Debugging on the error prone device. So, I can’t log for the error.

In your Wifi Direct tutorial you state that it is recommended to use Android 4.1+ devices, as there are several major known issues with Android 4.0.4 devices and Wifi Direct. I’m thinking that v-4.0.4 may be the reason for both my inability to setup USB Debugging, and for the app stopping on receiving a file transfer to this device.

I have uploaded my revised project, and would appreciate it if some kind soul would test it using two devices running Android v-4.1+.

Any help with this is greatly appreciated.

Best regards

Edit – After giving up trying to establish USB Debugging with the device running Android v-4.0.4, and a fresh boot of both devices, all is well. It would seem that my efforts to do USB Debugging on this device, while failing, also made it unstable. Hence, all the grief.

The app performs without problems and now, with the heart of the app functioning properly, I can proceed to finish it. Thank you for your interest.
 

Attachments

  • WifiDirect.zip
    58.6 KB · Views: 212
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…