I use background task with time trigger of windows phone 8.1 for update information and save it to offline, create a tile for notification for use.
I use Debug mode for testing on Emulator then every thing is ok, but every thing begin when I use Release mode for build in lumia 820 for testing.
Task is registered ok. But when BackGround task run, it close after some minutes.
I know there are some constraint about CPU and Memory for background task, but it is very hard for debug. Do you know any way for testing CPU and memory constraints? What is best practice for windows phone 8.1 backgrounds task?
I feel so tired with Background task of windows phone 8.1. Sometime it is ok, some time is none...
Related
I'm facing a problem with background tasks in Windows Phone 8.1.
I tried to create a new background task with Device User Trigger and Audio, but I got the error saying:
Package could not be registered.
I saw this:
Windows phone 8.1 deployment error when trying to use background task with audio and device use trigger in SO
Windows phone 8.1 deployment error when trying to use background task with audio and device use trigger in the MSFT Forum.
I tried the solution they pointed but without success.
Anyone knows how I can make 2 background tasks communicate?
What worked for me was this:
in one of the Background Task (the audio one) I created a Timer and checked if a LocalSettings value was or not true.
The other Background task was the one responsible to set it to true, so that what I want to do in the audio will happen as soon as I set the value to true.
I know that this is a "strange" way to do it, but it works ;)
I'm developing a Windows Phone 8.1 app (non-silverlight).
What I'm able to do at the moment:
1-I'm able to activate a background task from the UI that reads the accelerometer readings even when the screen is locked or the app is closed using
DeviceUseTrigger
and
BackgroundTaskBuilder
2-I'm able to activate a background task from the UI that plays an audio file even when the screen is locked or the app is closed using the
BackgroundMediaPlayer.Current
Now what I need to do is to play an alarm from the first task even when there is no UI. In other words the first task should be able to Run the second one. Using the BackgroundMediaPlayer does not work anywhere beside the UI thread...
Any help or idea would be appreciated!!
Have you tried using the Windows.Media.Playback.MediaPlayer (MSDN Link) class by any chance? I'm not sure if that works in a background task but it might be worth a try.
I would like to create an app which would pop-up fullscreen when user is not interacting with the device; the first tap would then close it. So it's exactly like a screensaver. It should "run" 24/7. Display should always be lit. Battery is of no concern.
I've already done this on android, but my WP skills are lacking and complete research would take me at least a couple of days, so I'm asking any WP gurus out there:
can the same functionality (screensaver) be achieved on the Windows Phone 8.1 platform?
If so, which are the basics that should be covered (programming-wise)?
Edit:
The only solution I have at this moment is changing the LockScreen background on a 30minute interval.
I'm still not sure whate happens in 2 weeks as some info suggests that the registered task will expire. Not to mention that LockScreen is shown only a few seconds.
Edit 2:
Subquestion: is there a way to keep LockScreen shown at all times (while charging)? Or maybe lauch lock screen from code?
Windows Phone doesn't usually allow apps to pop up on their own. Exceptions are made for specific usecases such as voip. There is also no way for an app that isn't running in the foreground to realise that the user hasn't interacted with the screen for any number of minutes.
Therefore your only option is to use the inbuilt lockscreen functionality.
I'm working on a Win Phone 8.1 App that uses the background audio player, but I'm having trouble, particularly when it comes to the cancellation event. I want to debug it myself to learn but I can't seem to find a way to manually cancel the background task other than to pause and wait 5 minutes while the app is suspended, something impossible while debugging.
Is there a way to do so cleanly (ie. Not artificially increasing memory usage)?
There come two ways to my mind, both quite easy to do:
invoke BackgroundMediaPlayer.Shutdown from your code
while debugging, hit Start, find Music app, open, start playing an audio file - hence there can be only one Instance of MediaPlayer, yours will be cancelled.
I have created a Window phone 8 app. Which changes the lockscreen image and notification in around 30 sec randomly.
My code works well in the emulator and device. When I install it through the code. My problem is that when I have submitted the app to the store as a beta app. And now I install the app from the store the app don't work as it was working. The lockscreen content don't change it remains static. I have checked the settings background agents that app is running in the background tasks but not showing the result.
What could be the cause that app is running well from the code but not from the xap uploaded to the store.
Link of app is http://www.windowsphone.com/s?appid=00d47e34-a551-4c98-b2a6-32e10babdc2f
am I missing any capability that need to fixed.
Your suggestions are welcome.
Because your title says you are using a background task and you are trying to do something every 30 secs, I assume that you're using ScheduledActionService.LaunchForTest to trigger your background task and which then performs the updating.
ScheduledActionService.LaunchForTest is only supported in DEBUG builds as a way to aid testing. It is not possible to submit an app to the store that is built in DEBUG mode so this will not work.
It is not possible to create an app which will update so often in the background. To have such an app would, potentially, drain the battery really quickly and so provide a very poor experience to users.
The best you can do is to have the background agent run on a periodic schedule (approx. every 30 mins) or trigger the updates via push notifications. (But this wouldn't work for the lock screen image.)