How to run application in suspend mode ? - Windows Mobile Development and Hacking General

Hello eveyone,
I do not know if this is the right place to post my question, if not please advice of where I should do so.
My question is the following:
Is it possible to configure WM5 registry keys so as to enable an application run in suspended mode. In other words when the PPC goes to stand-by-mode I would like my application to keep on running.
I have developed a Java application (runs with IBM J9) but when the PPC enters the suspend mode, threads pause and the application does not behave as it should do. My intention is not to completely disable suspend mode for the PPC, but just for an application (as it is possible to prevent e.g. the 'sound device' ('wav1:') from going to suspend mode, when the PPC goes to stand-by).
Thank you in advaced.

No
Read here:
http://blogs.msdn.com/windowsmobile/archive/2006/08/16/702833.aspx
and here:
http://blogs.msdn.com/windowsmobile/archive/2005/08/01/446240.aspx
Apparently, if you want your app to run, the device can't be suspended.

I'm not sure how useful this is, depending on your program, you might want to consider using notification queues to wake the PC up to run your software.
Anyway, I'm not sure how true what Setok said above, I do find many other programs that runs with my PPC is in 'suspend' mode. E.g. I've tried various timer (count down) program which seems to be able to run in background when after I press the power-button to suspend it. I wake my phone when it reaches 0. And it is done without using notification queue.

The links above certainly seem to authoritatively state that applications can't run in sleep mode, so I posted it. But hanmin's post made me wonder what was up, so I went looking. There are a few more states.
An application can use:
PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);
to put the device in unattended mode so that it doesn't suspend. In unattended mode the backlight, LCD, and audio still turn off.
There are a couple more power states explained here:
http://blogs.msdn.com/windowsmobile/archive/2005/08/10/450186.aspx
If you do put the device in unattendedmode be sure to call
PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE)
before you exit.
I just re-read your post, you want audio on, then use ScreenOff mode. See the above link.
Good luck

Registry way....
Hello guys,
thank you very much for your concerns and details.
To tell you the truth I have read all of these in the past. And I believe that since you can program this on-the-fly probably you can do it also by altering registry keys. In other words, not do it programmatically, cause this involves writting a C program (mu application is Java). After all if you notice ....the values that you can change through you C application to alter suspend mode for you application are 'registry values'.
My application is an event calendar, that checks the time and if there is an event it notices the user. When the mobile goes to suspend mode the thread pauses and the application does not work as appropriate...Tha't why I would like to set it in the registry-stage...
If you find anything of interest I would be more that thankfull
Thank you in advanced. ;-)
Christos

Hey,
have a look at the CeSetUserNotificationEx() function and the CE_NOTIFICATION_TRIGGER structure.
This is the way MS calendar app does it on the device.
Register your exe for a special time and if in suspend mode and
the time is reached you app will bestarted. Nice or?
Infos here: http://msdn2.microsoft.com/en-us/library/ms913969.aspx
Houser

Hi all,
I recently installed Pedometer on my HTC HD (with MaryOne X0.04☻Build 23502 COM5☻Leo 1.43), but I would like to "suspend" the device, and yet let the Pedometer run in the background, so it could measure my walk distance/steps.
I am not a programmer, but I could change a few registry settings if anyone could point me in right direction...
Thanks in advance,
cheers,
Nenad
p.s. - it should be possible, how all the other "background" programs are running (the clock, the notification, the G alarm...) ?

Related

Switch Radio on&off from .NET

Hi, I'm a .NET developer and I want to start to develop mobile apps.
My last device is a KJAM that need pen-tap to toggle radio on & off and this is a little frustrating for me (especially when it rains). So I decided to develop a simple (!) app so I can switch my phone on and off simply pressing the "red" button (for example).
Now I found how to bind the red-button-press event to my app but I really not yet found the (damn) method that let me to switch the phone (radio) on and off.
Can someone give me PInvoke samples to use in my C# app?
thnks
At least I can point you to an application, that does what you want.
read the thread http://forum.xda-developers.com/viewtopic.php?t=34831&highlight=
See my posts there (Conchas), and the .exe turned available by Koksie.
The same .exe toggles between enable/disable.
It is really great
thanks a lot ...
even if I wish to develop this app by myself (to start to "surf" the PInvoke hell) of course your advice will help me to reduce my frunstration switchin on my phone
You can always PM Koksie, asking for the function call he used.
I'll do it but he downloaded the program ... in the meantime ... the hardware button "4" now switch my radio on and off

Turning on phone at set time?

Hi. I frequently turn off my phone using the Comm Manager while leaving the PDA on during the evening. In the morning, I frequently forget to turn the phone back on and I was wondering if there was a program that can turn on (and perhaps turn off) the phone using the Comm Manager at a set time. Thanks.
Phone: 8125 on WM5 with original ROM
I'm looking for something like SleepWell.
http://www.connectivetools.com/sleepwell.html
The problem is that this program works only for smartphones. I tried it on my 8125 and it doesn't work. Moreover, the program deposited 300Kb of data which I can't seem to get rid of even after uninstalling it. But I'm still looking for such a program. Thanks.
Try Mortscript (Freeware). you can write a simple script that will set a notification event (or whatever it's called). I use it to run weather watcher automatically every morning. there are several forum strings, here and on others that have examples of different scripts that you can modify for your own needs. just do a google search for Mortscript, and Mortscript examples. It also has documentation included. Learning to use Mortscript will give you more control over your device than you ever though was possible.
I didn't think of MortScript, but even if I had, I don't have the technical know how to create do what I wish with a nice GUI.

[solved] How to prevent standby using VB.NET?

Hallo!
I'm working on an application called hTorch and although it is my first vb.net app I was quite successfull so far (at least I hope so ). But one think I'm just not able to achieve: Preventing the device from going into standby/suspend while the app is running.
In C++/C# there semes to be a system call "SystemIdleTimerReset()" but either there is no equivalent for vb.net or I was not able to find it.
Another thought was to modify the according registry key (HKLM\System\CurrentControlSet\Control\Power\Timeouts\BattSuspendTimeout) and to restore the original settings on program exit. This works fine except that WM does not apply the settings change immediately when it's done via registry. Again I did some research and again I only found a solution for C++/C# only. A system call named "NWUS_MAX_IDLE_TIME_CHANGED" tells the OS that the settings have changed and should be reread. I wasn't able to find something similar for vb.net though.
Does anybody know a solution for my needs?
Maybe someone could provide me with some sample code how he achieved this within vb.net?
Maybe some C++/C# programmer has build a library to access the power functions?
I would be really thankful for any help/hint you can give me!
Thanks in advance,
DeepThought
The standby mode is in the registry. Make a timer in VB.net and set it with an interval of about 5000 ms. Then make sure that ever time the timer ticks the standby mode will be disabled in the registry
Thank you for the quick response!
But the change via registry doesn't work. When I change the BattSuspendTimeout to 0 that does change the setting correctly. But they become not active. Only after a soft reset. It seems, that you somehow have to notify windows, that the settings have changed. Otherwise the will not be reread.
Any Idea how to achieve that?
I would also like to know if there is a way to prevent suspend.
I think only the pocket pc winmo versions do a real suspend where wifi and applications stop processing, and the smartphone winmo devices only kind of black the screen.
The only software I know is S2U2 which successfully can prevent "real suspend" and let e.g. my led notification work correctly.
Cause i cannot really use it on ks20 due to compatibilty issues i would be very interested in a reg hack, or (if there really is no reghack, i tried alot) some code snipets with which i could build a little app.
There's a pretty good article on CodeProject covering power.
*digs out link*
Here you go - http://www.codeproject.com/KB/mobile/WiMoPower1.aspx
It covers:
* Displaying the voltage, current, and temperature of your device's battery
* Changing the power state of hardware within the device
* Enumerating the hardware in a Windows Mobile Professional device
* Enumerating the power modes that a Windows Professional device supports
* Preventing a device from sleeping
* Toggling the state of the screen's backlight
* Waking up the machine to perform work without alerting the user or turning on the screen
[solution]
Thanks to AndyZap I can now answer the question myself
It is so simple, that I'm really ashamed now.
The magic word for me was PInvoke. Since I new the function I was searching for was an available win32 systemcall the missing link was how I can make this system call within vb.net.
So the actual solution are just two lines:
Code:
Declare Sub IdleTimerReset Lib "coredll.dll" Alias "SystemIdleTimerReset" ()
where "IdleTimerReset" is the name I've given the Sub. Which than just needs to be called like:
Code:
IdleTimerReset()
NOTE: This just resets the Idle timer once. So if you want to prevent the device from going into standby you have to reset this timer every time before it reaches the threshold. (The windows default setting is 60 seconds AFAIK).
THANK YOU AndyZap for your Help via PMail!
DeepThought
Thank you for your answer Northernmost!
I really love this community!

Possible solution for TF3D Qvga Standby issue, dev needed

Hi there,
cause most of you know the problem with TF3D Qvga and StandBy.
Could anyone here with knowledge of coding write a small app that acts like the standby timer in Windows Mobile?
I thought about something like that:
If no user action is recognize for time x, then deactivate TF3D (HKLM","\Software\Microsoft\Today\Items\TouchFLO 3D","Enabled","0")
and device goes to standby.
If device wakes up (or pressing power button) TF3D will be enabled again.
I think for someone with knowledge in development it shouldn't be mouch action, but it would be great to have a fully working TF3D and i think driver development still will need some time.
So, if someone is able to do that, please, please, please
I will test everything.
that should only be a few lines of mortscript, no ?
No itried this by myself (it's anywhere here in this forum) and i talked to Mort, too.
But there is no possibility in the actual version to recognize user actions.
The rest you can easyli write in MortScript, but not the user recognation.

Advanced Power Management

First of all, my compliments to all of you who keep this forum running by developing apps and sharing knowledge.
Secondly, I am in need of an application which will do advanced power management on windows mobile device. It should have an ability to change state of brightness, BT, WiFi, GPS (to turn them on/off) in the given time.
Does an app like this exist?
I've never used it, but I think G-Profile may do what you need.
http://www.ageye.de/index.php?s=gprofile/about
There's also a paid app called "ct scheduler" that lets you schedule (turn on and off) certain events like you asked, wifi, bluetooth, softreset, etc. I absolutely love it.
dschoenike
Thank you for the nfo! These appliations do almost everything i looked for.
In G-Profile when I try to edit settings for backlight it reports that my device is not supported. I was wondering if there is an external program which change backlight settings. This way i can use the "Execute" option to override this compability issue!
Go for CMP - Commmanagerpro - an ultimate tool for controlling your device based on schedules and PHONE MASTS !!
Use QuickMenu2.8, you got communication manager, task manager, power meter, mem meter, ram releaser, commandline utillity, a lot of shortcut, and much more others. It covers all you asked in a easy reach. It's freeware from China, thread here, tips here.
Edit: Sorry mistake, does not have GPS toggle & timed function from QuickMenu.
Suggest to use something like HButton, to map all your need functions into a hardware button, then by one touch you can do everything.
Yeah, but QuickMenu and CMP don't offer schedule options. G-Profile will do the job if i find a command which will increase/decrease backlight. My intention is to get the most out of the battery on my LG KS20 which doesn't have light sensor.
WRONG
CMP works very much with schedules - for everything, but the better part is that you can combine it with radio, so certain profiles are ONLY activated in certain areas....or you can choose that a schedule should override your position and always be activated..
AND how about the combination with OUTLOOK calender - to have schedules working for being busy/meetings in outlook...or when you are driving, the DRIVER schedules is loading, ´cause outlook says "driving"
YEAAR - is is a understated but very good app. The G-thing is like a very very lite version of CMP..
And I know
My bad...
I thought you were talking about Comm Manager (http://forum.xda-developers.com/showthread.php?t=376051)
I see now that CMP has more features than G-Profile, and it is less memory hungry! Backlight settings still don't work on my KS20, but that is very tricky and device dependant as I understand.
Thank you for your help...
I would recommend that you do some research to find what other users have said about the various power management programs. The search function will aid you in this. Also questions like this should not be posted here as this section is devoted to software releases, hacking and development, and not general inquiry type of questions.

Categories

Resources