Communication between Microchip PIC24F & Android device
You may implement a interrupt service routine in order to answer a request from the android and return the last generated value. Just make sure that you have a global variable with the last value, that should be updated each time inside the loop.

Another alternative is to make a pooling on the request on every loop, but this may increase latency on the response.

Microchip provide a good example on how to implement the basic functions on the board. You should make the code to provide the random number in a similar way the demo provide the analog input value from the potentiometer.