kirillzyusko / react-native-wifi-p2p

Library that provide access for working with wi-fi direct (p2p) module in android.
164 stars 32 forks source link

Sendfile is not working #22

Closed erdeepsangani closed 4 years ago

erdeepsangani commented 4 years ago

Sendfile is not working it log error

kirillzyusko commented 4 years ago

Hi @erdeepsangani What is the error?

erdeepsangani commented 4 years ago

Sir in device array secondary device is null

kirillzyusko commented 4 years ago

In which array? Could you attach log from JS + native logs? P.S. you also may find https://github.com/kirillzyusko/react-native-wifi-p2p/issues/15 useful

erdeepsangani commented 4 years ago

sir what is a syntex of uri to send a file from internal storage for android device

erdeepsangani commented 4 years ago

sir when i send file function called this error in occers:- Error while file sending {"code": "soon will be", "message": "Unknown error."}

kirillzyusko commented 4 years ago

@erdeepsangani could you capture adb logcat logs?

sir what is a syntex of uri to send a file from internal storage

These URL's were working :)

const url = '/storage/sdcard0/Music/Rammstein:Amerika.mp3';
const url = '/storage/emulated/0/Music/Bullet For My Valentine:Letting You Go.mp3';
erdeepsangani commented 4 years ago

I am using react-native-wifi-p2p in one of my project. as seen in logs and Wifi Direct network I am able to find Discover Devices and connect one of them. But when I try to send the message or file In Log Shows the Error "Error while message sending {"code": "soon will be", "message": "Unknown error."}" I am using the same code given in repo for testing. So please help me to resolve it.

Log of connect is "64646776467 {"groupFormed": true, "groupOwnerAddress": {"hostAddress": "192.168.49.1", "isLoopbackAddress": false}, "isGroupOwner": false}"

Log of getConnectionInfo() is "{"groupFormed": true, "groupOwnerAddress": {"hostAddress": "192.168.49.1", "isLoopbackAddress": false}, "isGroupOwner": false}"

erdeepsangani commented 4 years ago

sir what should i do??????????????

erdeepsangani commented 4 years ago

please sir answer me

kirillzyusko commented 4 years ago

I am asking about native/java logs. Not logs from JS. Internally in library happens unhandled exception. And library can not re-throw this exception to JS, since it's unexpected. That's why I am asking about Java logs captured via adb logcat.

erdeepsangani commented 4 years ago

Sir I am able to send only jpg file. When I am trying to send mp4 file.. It receive to receiver phone but this file is currupted and it's extension is. Jpg..... Sir what am I do now??

kirillzyusko commented 4 years ago

It seems to be truth... I hardcoded extension and filename on receiver side. As an option I can suggest you next combination:

Yes, it sounds like a hack and I definitely need to fix this issue in my library. But I can not say how soon it happens...

erdeepsangani commented 4 years ago

Sir please inform me when ever you solve the issue.. Please sir... My mail ID is. Drsangani1210@gmail.com please sir..

kirillzyusko commented 4 years ago

I would say that optimistic term is July. But I will try to keep you informed.

fncallback commented 4 years ago

@kirillzyusko @erdeepsangani I'm using this library and it is working perfectly fine. I was able to share any file across the devices.

kirillzyusko commented 4 years ago

@fncallback Hi. Nice to know :) How did you solve the problem with file name and file extension? As far as I remember I hard coded it. So any received file has .jpg as exension and the same file name (or timestamp - I don't remember exactly how I implemented it).

fncallback commented 4 years ago

@kirillzyusko yes made change in code to send file with any extension

kirillzyusko commented 4 years ago

@fncallback Nice😎 PRs are highly appreciate😉☺️

erdeepsangani commented 4 years ago

@fncallback sir can you write how you make it happen

sandipchandra17 commented 4 years ago

Dear sir, I am facing the same issue. I changed the file name and path according to the host(server) mobile like /storage/emulated/0/docs/filename.extension format but geeting the same above error.

kirillzyusko commented 4 years ago

Hi @sandipchandra17 File path should start with file:// prefix

kirillzyusko commented 4 years ago

Since we clarified, that method is working I'm going to close this issue. For all other problems, which were discovered here I will create separated issues.

sandipchandra17 commented 4 years ago

@kirillzyusko yes made change in code to send file with any extension

Dear sir, can you please send an example code where did you change the file name and extension.. as file is receving properly in my case but extensiin always is .jpg for all kind of files and fulename is wifip2pshared -timeatamp and in gallery actual jpg file not displayed.

sandipchandra17 commented 4 years ago

Hi @sandipchandra17 File path should start with file:// prefix

This is solved but why error message is throwing like error while file receiving code will be soon.. as per ur code its not showing succesfull msg rather going to catch block though file received in receiver mobile properly.

kirillzyusko commented 4 years ago

I'm going to fix the problem with extension/filename (you created new issue about this problem, so I'm going to post all actual info there).

According to another problem (why error is throwing in case of successful transfer) - could you please create new issue and attach actual logcat logs there?

P.S. This thread is too long, so I wouldn't recommend post any info here, since it's really difficult to track issues for other people who is trying to search their problem.

kirillzyusko commented 4 years ago

@sandipchandra17 @fncallback @erdeepsangani @sharmakumaraditya I fixed this issue in 3.0.0