0

I develop an application that running in the background. What I trying to do is the app running in background with time interval. When i testing the application with device (connect cable with computer), the application successfully running in background with every minute (depend on user set) and check the invoice in webservice. I also feel surprise because most of the article are telling that we can not running application in background with the time interval.

What the problem faced is when i unplug the cable and running the app itself in the windows phone, the app will not running in the time interval.

How to solve it? Is it impossible to do it on the device running itself? Why I testing with device connect cable successful running background in every minute?

Any help and advise will be appreciate. Thank you.

Below is my coding in the schedule task agent .

            int a;
            int b;
            int c;
            int d;

            d = intervalTimer * 3 + intervalTimer;
            a = intervalTimer;
            b = a + intervalTimer;
            c = b + intervalTimer;

            for (i = 0; i < d; i++)
            {
                Thread.Sleep(1000);
                if (i == 0)
                {
                    check();
                }

                if (i == a)
                {
                    check();
                }

                if (i == b)
                {
                    check();
                }

                if (i == c)
                {
                    check();
                    i = 0;
                }
            }
            NotifyComplete();
likewer
  • 216
  • 3
  • 16

1 Answers1

0

I have faced the same problem with android and I was no able to fix it. With cable as you said it was working at defined intervals but without cable attached to it it was simple ignoring the intervals...

My Question is still unanswered from months, Nobody explained the reason.

According to me either it Should work or should not work How a cable is able to affect the execution :-(

I had used alternative of time intervals "ALARM MANAGER" so as to fix it.. As this utility is predefined by Android OS to make it work like this..

I hope Something Such is also provided in Windows.. I would suggest you to go for that.

Providing some of the links that I think has potential similartiy to AlramManager

You can go thru below links to find the alternative like AlarmManager

Windows Phone Dev Center (BackGround Agents)

Windows Phone Dev Center (Implementing BackGround Agents)

Windows Phone Dev Center (MultiTasking)

DeltaCap019
  • 6,532
  • 3
  • 48
  • 70
  • Thank you Rathore. I know the AlarmManager, but unfortunately i doing the research in few month i can't find any alternative. – likewer May 28 '13 at 08:26
  • @likewer You can find the solution definitely in the links i had provided above, If you are not Novice to the Windows 8 development you will make out something from it. I cant even understand them right now to help you out, as I haven't even created a hello world program for this platform – DeltaCap019 May 28 '13 at 09:11