Notify new messages in chat app

in a private chat app wit AI2 and cloudDb thinked just for 2 people, how can you notify new messages, because of AI2 doesn't work in background mode?

Welcome Dab.

Consider:

  • use a StayAwake routine to prevent the app from sleeping
  • time stamp all messages
  • play a sound when a new message arrives
  • might be able to use a background extension with your app (uncertain this would work try Background Tasks: Itoo)
  • use a notification extension whenever a new message is posted and the app uses a notification extension and is not sleeping.
  • look at your Screen. When a new message appears you know there is a new message
  • send yourself or the other user an email when a new message arrives (is added to the chat List)
  • send yourself or the other user a Text (sms) when a new message arrives. (currently this is broken unless you use the test server. MIT has a fix but it is not yet deployed to the main server)
  • phone the other user? All messages can be tagged with respect to the sender. If msg is tagged, the app places a phone call . :astonished:

There may be other ways. Do any of these potential methods 'work' for you?

1 Like

you could try

Taifun

thank you very much, Steve
1.to use stayAwake routine, i think that means not to use the phone for nothing else. Is it right? what happen with the stayAwake if a call come in? Moreover there's the battery drain, so maybe it's not the best way.
2.Time stamp all messages, maybe i don't understand what you mean, messages has already date and time. what does it change? i added a bip at the .DataChange event of CloudDb and if the other user app is in backgroung, the bip is only at my phone, that's the problem.
3. Notification extension, do it work in background?
Maybe a solution could be a txt mess (whatsapp mess seems that it's not possible anymore), a phone call i think it's a sort of paradox ... anyway i'll try something

Regarding #1, I believe if you get an incoming phone call, the phone will work. ::slight_smile:

Regarding#2 if you use a sound file, the sound can work on both devices if you provide the code. I coded a game chat app that does sounds when a chat msg arrives

Regarding #3, I do not know. There are several notification extensions; one might run in background.

Yes, try something. Good luck.

:sweat_smile: yes, of course. i said it badly, i tought at what happen with some function like the pedometer, i noticed that it stop work, anyway nothing relate with this chat app