title: Broadcast Receiver for incoming chat message in Smack using Openfire
body: <p>I am creating a chat app using smack using openfire sever by XMPP protocol. I can chat with other user and working well. I created connection in Service class. <strong>So i am able to get notification message when i am not in my application</strong> but i get my service is restarting again and again when network problem, network change, network slow etc. So my connection is lost. and user is not always able to chat.</p>
  
  <p>So i solved connection problem. like as </p>
  
  <pre><code>if( service is not runing)
    start my service 
  else
   if(connection is NULL or not Connected)
    reconnection . so my connection is created
  </code></pre>
  
  <p>My service class:-</p>
  
  <pre><code>if(connection is NULL or not connected)
    reconnect. so my connection is created
   else
    not connected.
  </code></pre>
  
  <p>But now if my service is runing and connection is lost. and i open my application , a new connection is created. This connection is created by <strong>application not services</strong>. So now when i am not in my app , <strong>i did not get any notification for incoming message because incoming message was coming by service connection</strong>.</p>
  
  <p>Now i have involved. please expert help me. How can i solve?</p>
  
  <p>Is there way for push notification in openfire?</p>