Hi all.
I am currently developing an app which allow users to make a voice call over wifidirect (p2p calling)
Currently I am using Socket to establish a receiver-sender connection in each client side, and an UDP socket to transfer data. The sequence looks like diagram below:
Device 1 <========================> Device 2
Sender ======== Request call =========> Receiver
||
Receiver <======= Call responses ========= Accept / deny call
The receiver - sender are 2 separate services. Call request / accept / deny ... are using Intents.
There is an Activity which has a broadcastreceiver will process intents.
I want my app works line the normal call: User can request a call, accept a call, premature end a dialing, end a call.
But shortly I was overwhelmed by too many intents and the interaction between them.
For example, when I request a call, a CALL_REQ intent is sent.
The other device receives the CALL_REQ intent and pops up a dialog to accept or deny a call.
Then in device 1 I end the dial but at the same time I accept the call in the device 2.
The result is: device 1 ended the calling, device 2 starts a call session then sends back a CALL_ACCEPTED intent resulted in crash in device 1.
I believe that my design has problem with handling intents that may interfere each other because of latency introduced by Socket-Client model.
So please help me improve my design. I am thinking of looking for source code of Android normal Call but it seems very different from wifi-direct data stream.
I am currently developing an app which allow users to make a voice call over wifidirect (p2p calling)
Currently I am using Socket to establish a receiver-sender connection in each client side, and an UDP socket to transfer data. The sequence looks like diagram below:
Device 1 <========================> Device 2
Sender ======== Request call =========> Receiver
||
Receiver <======= Call responses ========= Accept / deny call
The receiver - sender are 2 separate services. Call request / accept / deny ... are using Intents.
There is an Activity which has a broadcastreceiver will process intents.
I want my app works line the normal call: User can request a call, accept a call, premature end a dialing, end a call.
But shortly I was overwhelmed by too many intents and the interaction between them.
For example, when I request a call, a CALL_REQ intent is sent.
The other device receives the CALL_REQ intent and pops up a dialog to accept or deny a call.
Then in device 1 I end the dial but at the same time I accept the call in the device 2.
The result is: device 1 ended the calling, device 2 starts a call session then sends back a CALL_ACCEPTED intent resulted in crash in device 1.
I believe that my design has problem with handling intents that may interfere each other because of latency introduced by Socket-Client model.
So please help me improve my design. I am thinking of looking for source code of Android normal Call but it seems very different from wifi-direct data stream.
0 commentaires:
Enregistrer un commentaire