92lleo / WhatsappWebToGo

[android] WhatsApp Web client for your phone/tablet with media support
https://f-droid.org/packages/io.kuenzler.whatsappwebtogo
MIT License
268 stars 42 forks source link

Possible to get notifications? #4

Open R2D221 opened 6 years ago

R2D221 commented 6 years ago

Would it be possible to receive notifications while the app is in the background? I know the web app issues web notifications, so maybe it could be possible to intercept those.

92lleo commented 6 years ago

Hi, using the web notifications api is not possible as the webview doesn't implement it. TSGames managed to get notifications from reading the ui, I'll merge it for a future update. The problem now is that you'll only get notified if WAWeb is running in backgroud. If it gets killed by your phone (there is no background task yet), you will not get notifications. Thats a blocker issue

WPFilmmaker commented 5 years ago

@92lleo maybe you could force the app into remaining in background? Perhaps have a thick box on whether to enable notifications or not and warn him that in order to see them the app has to run constantly and might drain the batter. Could be a temporary solution?

92lleo commented 5 years ago

I'm experimenting with a solution to keep the app starting in the background periodically and also send notifications in case of new messages. Notifications alone would not be reliable and the battery impact of keeping the app in background all the time would be to high

WPFilmmaker commented 5 years ago

I don't know if it can be useful but Frost (a facebook wrapper. https://github.com/AllanWang/Frost-for-Facebook) uses "Android's Job scheduler, and lets the framework decide when to run background services...therefore doesn't need to constantly run in the background nor does it force your pone to stay awake". Maybe you can use the same approach?

ristein commented 3 years ago

hey, this would be a nice feature. Is there any progress? Checking for new messages every few hours would be great

JXWw3wLD9LArcR7c commented 3 years ago

I have a couple of suggestions

  1. Adding an optional permanent notification, doesn't display messages, it may consume more battery but the user will be warned about this and it will be optional. The permanent notification will keep the application alive in the background, but it won't display any messages. This is a solution that Accubattery, Blokada, and Macrodroid uses to stay alive. Blokada is open source
  2. I notice that I can at least get sound notifications. If the app detects sound while it's not active, a notification can pop up that says "you may have some messages". Hopefully there is a way to differentiate sounds from this app from system sounds or sounds from other applications
  3. Temporary solution for users: Use the feature to lock the app on your task manager in order to prevent yourself from closing it. This is usually done by opening your task manager (pressing 3 line button) and hold press the app icon. It may be different on your device
92lleo commented 3 years ago

Hi Simon,

thanks for the input

  1. The permanent notification seems like the easiest idea compared to a service checking for new messages or something similar. I'll put this on top of my todo, together with the needed settings page
  2. Thats right, but there is already an easier way, see the poc fork from https://github.com/TSGames/WhatsappWebToGo/. I just need to adapt /include that
JXWw3wLD9LArcR7c commented 3 years ago

awesome!

ronz91 commented 3 years ago

Any updates regarding this?

ristein commented 3 years ago

I built an automater script that sends me an email on new messages from the android phone running whatsapp. I can share that in the evening if anyone is interested

ronz91 commented 3 years ago

@ristein sorry I am new on Git, how do I private message you?

ristein commented 3 years ago

I forgot it yesterday. Will publish how I built that today

92lleo commented 3 years ago

@ristein are you doing this via reading the whatsapp-android notifications or grabbing notification from whatsapp web? The later would help here, the first one might still be interesting for others here :)

ristein commented 3 years ago

I only grab the android notifications, which is not related to this app

ronz91 commented 3 years ago

Hi Simon,

thanks for the input

  1. The permanent notification seems like the easiest idea compared to a service checking for new messages or something similar. I'll put this on top of my todo, together with the needed settings page
  2. Thats right, but there is already an easier way, see the poc fork from https://github.com/TSGames/WhatsappWebToGo/. I just need to adapt /include that

Could you elaborate on how #2 would be implemented/how it works? Noob programmer apologies in advance.

ristein commented 3 years ago

to get email notifications on new messages I used this app on the phone running whatsapp: https://play.google.com/store/apps/details?id=com.llamalab.automate and this script (importable via that app): Send mail on noti.flo.zip

add your email preferences in the email-block. get a dump-address for this, don't give them your main address's password

ftpmorph commented 2 years ago

The current release of WhatsApp (not beta) allows the user to login with WhatsApp Web without their phone being nearby. It's a beta feature you're prompted to enable but it's on the regular production app from the Play Store. (Screenshots below.)

Given this addition, setting up WhatsApp in a VM or a spare phone then using WWTG as a primary WhatsApp client on your main device is now very much doable and it's exactly what I am doing. It works well, the only missing piece is the notifications.

Even if only as a short-term solution, having a persistent silent notification that keeps the app running and checking for new messages seems like the standard way to do this. It is what Signal already does if you install it on a phone without Google Play Services.

Although if the method used on that Facebook wrapper to periodically check for notifications without running the background can work without a GSF dependency that'll certainly be better for battery.

Either way a notification feature would be great, currently it is the only thing missing that makes this a 100% viable alternative to having WhatsApp installed on your main device imo. Everything else works great.

IMAGE 2021-10-13 1:24:34 pm

IMAGE 2021-10-13 1:24:53 pm

ronz91 commented 2 years ago

Yeah with Multi-device beta it is almost there.

I have been using the beta since it was released and it works well for the most part.

Been using it to access the account on my other phone from my main phone.

Hopefully between WWTG and Multi-device 2.0 there will be a complete solution soon.

92lleo commented 2 years ago

@ftpmorph @ronz91 the settings page I wanted to configure all of that takes longer than expected. In the meantime I'll release a beta with persistent notification enabled by default, which hopefully helps in the meantime