My question -I want to use speech recognition API that work when application is in background. Is it possible.
While the speech APIs aren't in the list of Unsupported APIs for background agents for Windows Phone this does surprise me.
I suspect that you are actually trying to have an application which is always listening in the background but this is not what a background agent will do. At best it will only run periodically (approx. 25 seconds every 30 mins) and I assume that's not what you want.
There is no way to create an app that is always running in the background. Regardless of whether it is doing speech recognition.
I have never actually tried this, but I'd say I doubt that it is possible for the following reasons.
1) Background tasks run for a limited time period at a specific interval. The chances of the agent being active when you want it to be are very slight.
2) How would you notify your agent that you want to give it voice input if your UI is not running?
Related
Two part question:
First, does the Apple TV run app activities in the background while it is asleep? I would assume this would be the case since the Apple TV isn't relying on battery.
Second, if this is not the case, how would I override this keep an app running and writing to my database?
I am building an app that connects to Bluetooth LE, then writes to a database after connecting. I would like the Apple TV to be the "hub" for my device. So as long as the Apple TV can stay awake, unlike iOS, I should be fine. I could be looking at this the wrong way. Please feel free to correct me.
tvOS runs the same application state mechanism that iOS does. Meaning it has the same old:
not running > suspended > background > inactive > active
This also means that it will do basic background processing based on very specific background tasks you specify, just like iOS. Though, tvOS does not have a background data-refresh function, which I'd imagine you'd want to use for the scenario you described.
Check out this Apple doc for more modes. https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22
To specifically, answer the question: There may be a way to do some background data work, but it would be very limited; And you can prevent sleep programmatically by doing:
[UIApplication sharedApplication].idleTimerDisabled = YES;
This apple doc will give you all you need to accomplish this.
https://developer.apple.com/documentation/uikit/uiapplication
I am developing a Windows phone 8 app that need to run only in background with UI. Is there any way I can run the app in the background, or without actually being open?
It depends upon what you want to do in the background. Generally speaking you can't implement something like a Windows service that will startup automatically when the phone is launched.
That said you can run your app in the background within given limitations. Check out MSDN for detailed information.
Why all these limitations you might ask yourself? It's to provide a good battery life to the user.
Edit:
For the periodic agent to start running the app must be started once. Further the agent must update a live tile (user must pin it to the start screen) or the app has to be once opened every 14 days.
Another option might be using push notifications to trigger an update..
I'm in the process of developing a WP8 app that makes use of the background location tracking abilities provided by the OS. The idea is to monitor the users position and to notify them when they are near certain types of places.
So far it all seems to work fine and when running the location tracking works as I would expect.
The problem is, it seems that the phone times out background apps after around four hours, stopping the location tracking.
I can understand why Microsoft did it, to preserve battery life etc. But there's not much point having a background location tracking app that has to be manually restarted every four hours! If a user chooses to run this app and is made aware of the potential battery hit, surely it should be able to run indefinitely - to a point of course, if the system runs out of resources or similar then that's fair enough.
Does anyone have any experience with this? There must be hundreds of others apps in the store that have run into this issue I would have thought? And presumably there must be some way of keeping the location tracking running?
I've tried periodically updating the live tile (using a DispatcherTimer) while the tracking is running but this doesn't seem to be enough to keep the app alive either :(
Anyone have any ideas?
Thanks.
There is no way to achieve your desired behavior. The app will be deactivated under anye of following conditions:
The app stops actively tracking location. An app stops tracking location by removing event handlers for the PositionChanged and StatusChanged events of the Geolocator class or by calling the Stop() method of the GeoCoordinateWatcher class.
The app has run in the background for 4 hours without user interaction.
Battery Saver is active.
Device memory is low.
The user disables Location Services on the phone.
Another app begins running in the background.
Source: Running location-tracking apps in the background for Windows Phone 8
What you could do is to show a toast notification before app is deactivated advising the user, and make him navigate back to the app, extending the period for other 4 hours that way.
There is no way to keep it running without any user interaction.
I've used background transfer service (BTS) API for Windows Phone in two apps and experienced very bad problems. It became one of the main source of bug in the two apps as for some reasons, download are often refusing to start, whatever I set in the flags (Connected to wifi, not connected, connected to a power outlet, etc.), and it was random from a user to another. This and bad response from the servers.
Is there a more customized way to achieve it? Which threads or loop remains alive in my app when I'm navigating to the external:// world? I should probably check with counters.
My main question remains: appart from the BTS, is there something to allow a 3-4 megs file to upload even if I navigate out from my app to play an mp3 from an external:// app?
Once you exit your app, you are pretty much shut down. You can masquerade as a location tracking background agent to remain in the background when you get deactivated, though you'll suck battery and I believe there can only be one of these active at a time. Generally, highly not recommended (and you'll probably fail certification).
A better way to do this if BTS is not to your liking is to use a ResourceIntensiveTask. This will only be triggered when the user is plugged in and has WiFi but will allow you to run whatever you want for as long as the conditions are met (for example, at night) which should be plenty of time to upload a 3-4 MB file.
I'm going to make a simple toast notification using periodic task of background agent, what
I'm asking is how can I show notification in specific time, but without playing sound notification or vibration, is there any way to achieve it?
Since what I've seen at http://msdn.microsoft.com/en-us/library/hh202962%28v=vs.92%29.aspx that VibrateController is unsupported api in background agent
Thanks!
It's completely up to the user to decide whether he/she want the sounds and vibration or not. There is nothing we can do as a developer to control such things. I believe it is one of Microsofts philosophies to not end up like Android in such matters.