Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello awl..

i 've developed and aap which sends email through the windows phone 7 plateform...i want to run that app on the background of the screen...means to say it should be invisible to the user that this app is running on his mobile so plz help me what should i do????
Posted
Comments
Andrew Piotrowski 28-Dec-11 19:33pm    
Need more info - i have the same problem but with app for changing the locker screen. It also needed to be loaded and be working in the background. My solution was an application allowing( info box) that the program will work in background ( need to think about beacuse if you want to get this app to the windows phone marketplace , users need to know about that the is some program running in the background ) - For more info - PM me.
aounali 29-Dec-11 11:39am    
actualy i m developing the service based app for mobile.... and i want that, it should run in the backgroud of the windowsphone7.......

1 solution

Ok. I have used this in my app :
C#
#region private members 
        bool runsUnderLock; 
        bool isRunningUnderLock;
        bool hasUserAgreedToRunUnderLock;
        bool isRestartRequired; 

#endregion 

#region public properties 
        public bool RunsUnderLock
        {
            get
            {
                return runsUnderLock; 
            } 
            set 
            {                
                if ( value != runsUnderLock ) 
                { 
                    runsUnderLock = value ; 


                    if ( runsUnderLock ) 
                    { 
                        PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
                        PhoneApplicationFrame rootframe = App.Current.RootVisual as PhoneApplicationFrame ;

                        System.Diagnostics.Debug.Assert(rootframe != null, "This sample assumes RootVisual has been set"); 
                        if (rootframe != null)
                        {
                            rootframe.Obscured += new EventHandler<obscuredeventargs>(rootframe_Obscured);
                            rootframe.Unobscured += new EventHandler(rootframe_Unobscured);
                        }
                         
                    } 
                    else 
                    {
                        IsRestartRequired = true;
                        // we can not set it; we have to restart app ...
                      //  PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Enabled ; 
                        EventHandler eh = RestartRequired;
                        if (eh != null)
                            eh(this, new EventArgs()); 
                    }

                    SaveSetting("RunsUnderLock", runsUnderLock); 
                    OnPropertyChanged("RunsUnderLock"); 
                } 
            } 
        }</obscuredeventargs>


You can read this :
Solution

Please rate if a helped you :)
 
Share this answer
 
Comments
aounali 29-Dec-11 16:32pm    
actualy let me clear it further that i m developing an app like spyware... it sends email to my account but prob is that i want it to run in background of the windowsPhone7 so that user shouldnt b able to see that,,a copy of mail that he sends will be send on my email address tooo.... thats it ...can you help me in this if can... :( Thnx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900