5

What is the best way to get whatsapp messages in the moment messages are received. Is the easiest way to read the notifications of the phone or is there a better way? Root permissions are allowed.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Panther
  • 435
  • 4
  • 16

2 Answers2

1

I may have 2 solutions:

  1. Check every x seconds for unread messages and save the id of this message. Next time check again for unread messages which have an id higher than the previous one. Then the app knows which message is new and can read all new ones.

  2. Use AccessibilityService to get notificated when a new message from whatsapp was received and follow the same steps.

Tell me if it helped or if it's a bad idea :D

Panther
  • 435
  • 4
  • 16
  • as per my knowledge through notifications, you can only read the messages if it is single i.e. the message is visible in notification bar, but if in the notification bar it shows "2 messages" or something like that than you won't be able to read it. and AccessibilityService i tried it also didn't work out, do let me know if it helps you or any other solution. – Karan Khurana Dec 19 '15 at 10:52
  • It doesnt read the notificatons. The accessibilityService just gets triggered if a New whatsapp message is received and then checks the whatsapp database for unread messages as described above. – Panther Dec 19 '15 at 11:20
  • This needs root for sure. – Panther Dec 19 '15 at 11:20
  • If rooting is needed, than this solution won't workout as very rare people root the device. – Karan Khurana Dec 19 '15 at 11:45
  • Yes, but i want to send messages in whatsapp too. Root is needed for my app anyway. Sry that i can't help you – Panther Dec 19 '15 at 14:37
0

I have also researched in this field, the only best way i found through my research is reading through notifications. As WhatsApp encryption is increased to crypt8, till crypt7 it was possible to do this.

But if you find any other solution to it will be much appreciated.

Karan Khurana
  • 575
  • 8
  • 20
  • I thought about reading the database of whatsapp every x seconds and check if there is an new unread message, but there is a Problem: My app cant check if it already got that message, because the message has to stay unread. – Panther Dec 18 '15 at 14:33
  • Do you have any idea how to read the single messages from the notifications? – Panther Dec 18 '15 at 14:34
  • Okay i looked around and the only and best way is to do it with notifications.. Is there a good example how to get the notification with package name? – Panther Dec 18 '15 at 15:09
  • Please tell me then how the spy apps can able to read Whatsapp sent and received messages without even rooting? – Gvtha Feb 18 '18 at 11:46