Running application in background and catching incoming and outgoing messages - c++

I am working on one app which I want to run in background and it should handle the event when any sms gets received and my application should receive that sms even if this application is closed. Till now my application is getting sms only when it is opened . I want it to catch all messages received even it is closed. Similarly I want this for sent messages .
Could anyone please tell me how should I do this?

Right now the only way to do that would be with a long running headless application. You will need a special signing key and it won't be available to users until 10.2.1 is released.
Also, BlackBerry is far more protective of user privacy than some other platforms. You will likely only get permission to run such an application headless if you have a very good reason to access all incomming and outgoing SMS.

Related

How do mail programs display the list of messages so fast when they start up?

I am working on an IMAP client application that connects to the mail server and loads the message headers into a list view.
In my application, it takes a long time to load. I've set it to connect and load the messages when I start the application.
I see that when other e-mail clients using IMAP load, all of messages are there instantly, even if there are 500 messages in the list.
How do they do it? Do they actually save the last list before the application was closed? Some other way?
Yes, email client apps usually cache downloaded messages locally for performance and then resync with the server periodically to resolve changes performed over time. In the case of IMAP, it can notify clients in real-time when emails are added/deleted/moved (Indy's TIdIMAP4 does not support that functionality yet, though), but you would have to resync manually at startup to account for changes that occurred while your app was not running.

An already running application to be informed about an incoming SMS - Windows Mobile 6.5

I have a C/C++ Windows Mobile 6.5 application that continuously runs on the phone. It needs to analyze the SMSes. How can I be notified in my application about an incoming SMS? I read in MSDN about the SmsSetMessageNotification() but this is starting an application once the SMS comes in, and in my case the application is already running, it just needs to be informed that a new SMS was received and then should have access to it in order to analize it and to decide if it's of any interest for the application or not.
So how can my already running application be informed about an incoming SMS which then needs to be analyzed?
I believe you need to use the IMailRuleClient to sign up for notifications of a text message being received.
There is a sample application as part of the sdk that demonstrates this functionality. You can download it from MSDN Code Samples
You can achieve your goal using the Radio Interface Layer (RIL) API. Download RIL.H to get started. Then use LoadLibrary and GetProcAddress to dynamically call the RIL functions from the DLL at runtime. You can setup a RIL notification callback to notify you when message activity happens. I found a code example here.

How to capture that session logoff started from windows service

I have a service which constantly checks some application and assures that it wasn't closed. If this app closed - service launches it again.
The problem starts when user decides to log off the session. During logoff all applications are closing including the mine one. But the service is still running and constantly trying to start it again.
The questions is how to notify the service that user is going to log off and the application doesn't need to be restarted anymore? I've tried to make it using SERVICE_CONTROL_SESSIONCHANGE notification. But in accordance to MSDN they come to services when all apps already closed and logging off procedure completed. It is too late for me. Is there any way to programmatically find out that current session is in process of logging off?
My service launched under LocalSystem account.
Thanks.
p.s. I don't have the access to application source code. The goal need to be achieved without modifying it.
Have your service run two applications: the one it is a watchdog for, and a second one which you implement yourself. This second one can then respond to the log-off event by sending a message to the service (a la David Heffernan's answer), and the service will then know not to restart the watched job.
Open a communication channel between your app and your service and arrange for the app to tell the service that it is closing because of a logoff event.
You may not have access to the source code of the executable, but that doesn't mean that you can't affect the process. For instance, you could inject a DLL. Using SetWindowsHookEx, you'd catch the WM_ENDSESSION sent to the apps main window.
Why don't you create your service under the user that is running the App and tell it to startup automatic? In this case you should get the SERVICE_CONTROL_SHUTDOWN message when your user is logging off since the service would also be terminated.

How to receive power off events in a Symbian console application?

I am looking for a working code example for Symbian S60 5th edition in which a console application can receive power off events (i.e. detect phone switch off). I know how to do this from UI application [AppUI, HandleSystemEventL(const TWsEvent& aEvent), etc], but Windows Server does not seem to send events if simple console application is listening to these events.
So, I have tried to connect to WS, call EventReady(&iStatus), but RunL is never called, and the application never receives EApaSystemEventShutdown.
Can anyone here provide working code for this?
Thank you.
You can use CSaveNotifier (savenotf.h, powermgrcli.lib) to receive powerdown notifications. Sorry, don't have a code snippet available at the moment.

Windows Mobile WAP Wakeup

could anyone please give me directions, or better - a working sample, of using the "WAP Wakeup" feature in Windows Mobile?
I'm trying to follow directions from http://msdn.microsoft.com/en-us/library/aa919167.aspx . Unfortunately, they only give the beginning of the solution.
Step 1: register your application to listen to SMS messages coming from a specific port.
Step 2: send an SMS message to that port
Step 3: the application opens up and sends a message to the application listener class window
Step 4: receive that message and bubble up an event
I am clueless about steps 2-4.. are those even the right steps?
I have not done this myself but I have worked in a simlar area.
There are two ways to send the WAP SMS Message (basically a binary Wireless Datagram Protocol (WDP) formatted binary SMS message)
By Phone using the WAP api.
Using a SMS gateway.
A SMS Gateway allows you to send sms messages from the internet. If you search on the web for SMS gateways you should get lots of them. Pick one that supports sending Binary SMS Messages.
As part of the WDP header you have to specificy a port number, which is the port number they go on about.
Before you send the sms message, you need to check with your cellular provider that they support binary sms messages, not all cellular networks do.
The rest of it is pretty much following the Microsoft Example:
Create the registry setting.
A WDP SMS messages arrives at the WDP layer on port WDPport1.
The WDP layer checks if the application is registered with the WDP
layer on Port Number WDPport1. In this
case, no application is registered.
The application checks the registry to determine if any application is
registered for WDP messages on Port
WDPport1., The application finds that
Chess.exe application is registered.
If Chess.exe is loaded, the application launches Chess.exe.
The chess application opens "ListenerWnd" Listener Window Class.
"ListenerWnd" receives a message with DWORD value
Chess.exe recognizes this message as an indication that a WDP message is
awaiting on port WDPport1 and
registers WDPport1 as it's own with
the WDP layer.
Chess.exe receives and processes the awaiting WDP message.
Chess.exe closes.
i sent a binary sms by all rules, created a registry settings, application... all as written at the Microsoft forum about WAP Wakeup... but when mobile receives sms, its directly goes into Inbox....
may by anybody can tell on which aspects a need to make a point.. because.. 3 days on this problem.. this is not good :-(