Android Question Bluetooth delay between sending from other device and receiving in APP

Discussion in 'Android Questions' started by petr4ppc, Apr 21, 2015.

  1. petr4ppc

    petr4ppc Active Member Licensed User

    Dear friends,

    please, I have this situation:

    I.) Android APP with A) device
    1) I am using service for receiving data via Bluetooth
    2) I am using in service this settings:
    Code:
    AStream.Initialize(Main.Ser1.InputStream, Main.Ser1.OutputStream, "AStream")
    II.) then if I send data from device B) to device A)
    Data are simple. Only for example "HALLO"

    Then in moment I see in Logs, first
    and then after 1 second I am receiving data
    "HALLO"

    But it take 1 or 1,5 second between sending and receiving data...it is too much

    Please, where is trouble? I must get shorter time between sending and receiving data and I need use service for receiving seriál data.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    AsyncStreams raises the NewData event immediately when there is new data available. The service also doesn't affect the communication speed.

    The problem is somewhere else. Try to test it with a different device. Bluetooth is problematic on some devices.
     
  3. petr4ppc

    petr4ppc Active Member Licensed User

    Thank you very much Erel for your help.

    I will try another devices.

    But I know, that "HALLO" is received immediately, because in LOG I immedaitely see this:
    And after 1,5 second I get "HELLO".
    Delay exist because of Activity go to PAUSE and RESUME mode....

    Can I have something wrong with calling functions in MAIN?
    If I have in service this?
    Realy here can not be trouble?
    Code:
    AStream.Initialize(Main.Ser1.InputStream, Main.Ser1.OutputStream, "AStream")
    Thank you very much
    Best regards

    p4ppc
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Assuming that your code is correct then the activity doesn't have any effect on the service.

    Make sure that you are not doing anything with AsyncStreams from the activity. You can also call Service.StartForeground to make sure that your service is not killed.
     
  5. petr4ppc

    petr4ppc Active Member Licensed User

    Thank you very much Erel,

    I go test it.

    Best regards
    p4ppc
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice