title: Get Offline messages in XMPP
body: <p>In my chat application I want to get the offline messages when the user signs in ( if anybody has sent him messages) . I am getting the notifications when the user is in online state and not able to get the messages after the user signs in back. I have checked the xmpp log cat also. I am able to read the offline messages there but i am unable to notify the user his/her ofline mesages.</p>
  
  <p>Here is the listener which I am using in onStart of my service ( service is immediately started on user logon)</p>
  
  <pre><code>PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
          final PacketCollector collector = connection.createPacketCollector(filter);
          connection.addPacketListener(new PacketListener() {
  
              @Override
              public void processPacket(Packet packet) {
                  // TODO Auto-generated method stub
                  //notification(packet.getFrom());
                  packet = collector.nextResult();
                  Message message = (Message)packet;
                  senderName = packet.getFrom();
  
                  int alphaPOS = senderName.indexOf("@");
                  String subSenderName = senderName.substring(0,alphaPOS); 
  
  
                  if(UserChatActivity.checkPresence==false){
  
                      notificationforChat(subSenderName+": "+message.getBody(),packet.getFrom().toString());
  
                 }
  
              }
  
          }, filter);
  
      }
  </code></pre>
  
  <p>This works fine when user is online. But I want that once the user logs in he should be notified his messages</p>
  
  <p>Thanks </p>