Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7704629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:43:25+00:00 2026-05-31T23:43:25+00:00

Helo. Im developing an application that transferes data over bluetooth(with a flight recorder device).

  • 0

Helo.

Im developing an application that transferes data over bluetooth(with a flight recorder device). When i am recieving a lot of data data(3000 – 40000 lines of text, depends of the file size) my aplication seems to stop recieving the data. I recieve the data with InputStream.read(buffer). For example: I send a command to the flight recorder, it starts sending me a file(line by line), on my phone i recieve 120 lines and then the app stucks.

Intresting is that on my HTC Desire the app stucks just sometimes, on the Samsung Galaxy S phone the application stucks every single time i try to recive more than 50 lines.

The code is based on the BluetoothChat example. This is the part of code where i am listening to the BluetoothSocket:

byte[] buffer = new byte[1024];
int bytes =0;

while(true)
{
    bytes = mmInStream.read(buffer); 
    readMessage = new String(buffer, 0, bytes);
    Log.e("read", readMessage);

    String read2 = readMessage;
    //searching for the end of line to count the lines(the star means the start of the checksum)
    int currentHits = read2.replaceAll("[^*]","").length(); 
    nmbrOfTransferedFligts += currentHits;
    .
    .
    .
    //parsing and saving the recieved data         

I must say that i am running this in a while(true) loop, in a Thread, that is implemented in an android Service. The app seems to stuck at “bytes = mmInStream.read(buffer);”
I have tried to do this with BufferedReader, but with no success.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:43:26+00:00Added an answer on May 31, 2026 at 11:43 pm

    The app seems to stuck at “bytes = mmInStream.read(buffer);”

    But that is normal behavior: InputStream.read(byte[]) blocks when there is no more data available.

    This suggests to me that the problem is on the other end or in the communication between the devices. Is is possible that you have a communication problem (which is a bit different on the Galaxy vs. the Desire) that is preventing more data from being received?

    Also, I would suggest that you wrap a try/catch around the read statement to be sure that you catch any possible IOException’s. Though I guess you would have seen it in logcat if that were happening.

    Speaking of logcat, I would suggest that you look at the logcat statements that Android itself it generating. I find that it generates a lot for Bluetooth and this might help you to figure out whether there really is any more data to be read().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Helo ! I am working right now with an application that uses BOOT_COMPLETED receiver.
Helo everyone. I have a class MyClass and a function escape () that can
Helo, I have implemented a chat application using Comet. the request is hang on
Helo, My question is I have one Stored Procedure in SQL Server that returns
Helo. I want to have few instances of webclient that all share all the
Helo! Dropdown in IE7 displayed not correct. When I put mouse over it's appears
Helo, I am trying to run rake db:migrate for my rails 3 application using
Helo. I am building an application for kids using Phonegap. On Android I have
Helo, A library like jQuery is fully loaded and comes with many functions that
Helo! Is this possible to use string value of one node which tells what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.