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();