Operate Relay Via Android mobile app Home Automation

Hi all

Dear friends i am stuck in between of my Project to operate 2 channel 12vdc relay via my android mobile using "ARDUINO BLUETOOTH CONTROL DEVICE" android application.

first take a look.
Following is my Code which i am using.

/*
* Home Automation
*/
int relay1 = 3; // light 1
int relay2 = 4; // light 2
int state;
int flag=0;        //makes sure that the serial only prints once the state

void setup() {
   // sets the pins as outputs:
   pinMode(relay1, OUTPUT);
   pinMode(relay2, OUTPUT);
   // initialize serial communication at 9600 bits per second:
   Serial.begin(9600);
}

void loop() {
   //if some date is sent, reads it and saves in state
   if(Serial.available() > 0){     
     state = Serial.read();   
     flag=0;
   }   
   // if the state is '0' the relay will turn off
   if (state == '0') {
       digitalWrite(relay1, LOW); // relay1 off
       digitalWrite(relay2, LOW); // realy2 off
       if(flag == 0){
         Serial.println("relay: off");
         flag=1;
       }
   }
   // if the state is '1' the relay1 will on
   else if (state == '1') {
       digitalWrite(relay1, HIGH); // set relay1 high
       digitalWrite(relay2, LOW); // set relay2 low
       if(flag == 0){
         Serial.println("relay1: on");
         flag=1;
       }
   }
   // if the state is '2' the relay1 will on
   else if (state == '2') {
       digitalWrite(relay1, LOW); // set relay1 low
       digitalWrite(relay2, HIGH); // set relay2 high
       if(flag == 0){
         Serial.println("relay2: on");
         flag=1;
       }
   }
}

i compile it successfuly
i upload it successfuly
but nothig is heappning when i am pressin "OFF or ON" from my mobile
i am attatched the screen shot of android application whinch i am using for this purpose.
please guide me where i am going wrong,
either i have need to edit somthing in coding or need to change mobile app
please help me to solve

thank you

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Do you properly establish the connection android to Bluetooth?

YES

LED of BT module confirm that connection is established.

  1. Is the Rx<>Tx wiring kosher?
  2. Have you tested the proramme using the serial monitor?
  3. I would be inclined to use Bluetooth Terminal so that you can get a better idea of what is going on.

And further
I don't like your code but it will say it is turning relays on and off when it receives the relevant number from monitor, and therefore it should do that. So, maybe

  1. The relays are too big for Arduino to actuate

  2. Relay wiring is suss

  3. bluetooth wiring ditto