Is there any option to start/stop compass after compass sensor was requested.
I would to stop receiving events from compass to save battery but found no such an option (no dispose, no close, no stop as we have for windows phone)
Thanks!
if you are using C# you can unsubscribe for the event to stop receiving notifications from the compass. I dont think it is possible to turn off the compass altogether as other applications may be using it
Subscribe:
_compass.ReadingChanged += new TypedEventHandler<Compass, CompassReadingChangedEventArgs>(ReadingChanged);
UnSubscribe:
_compass.ReadingChanged -= ReadingChanged;
Related
Here is the demo with mute unmute logic of agora client lib
Main problem is that MediaStreamTrack switching to 'ended' state after setMuted or setEnabled and it is not going back to 'live' state after reverse action on those methods of LocalAudioTrack so I can't use it with AudioContext for audio processing.
Even volume-indicator event on AgoraClient stops firing after mute and unmute actions on LocalAudioTrack
So what is proper way to make mute and unmute and to get actual active native MediaStreamTrack?
You should be able to use the setMuted method which doesn't destroy the track (only stops publishing it) for your use case to continue your processing on the track.
I'm unable to reproduce the the volume-indicator event stopping after mute as you described, I'm attaching a screenshot of the log below.
When I am running my application on Android device (virtual device) It connects using WebSocket. It's normal flow and there is no question here. When I am using the virtual device for developing I use "Reload" all the time (sure). Can I intercept the reloading process for disconnecting the WS connect? If I do not it manually that my backend won't get relevant event.
You can try to emit the disconnect message in the componentWillUnmount() function. It is bad to use it in a normal app flow (in a back button for example) as it is normally an async function and it is not a good approach to call async functions in the componentWillUnmount(), but in cases that you will only handle the "quit" (reload in your case) I think that this solution can help.
I have an (old) audio app that is misbehaving on iOS 5.1.1. It records audio and on older iOS versions (don't know precisely where the "break" is) it would stay "in foreground" while recording, without any nudging.
But on 5.1.1 the app is put into background after two minutes, and then things go sour. Currently (will have to change this, I suppose) the app kills recording when it's backgrounded (and it appears to do this successfully), but it still dies with a trap in the above routine.
Unfortunately, the call stack is empty when this occurs, so there's little clue as to why the app's getting killed, but I gather (just from hints here and there on the web) that the trap occurs because a background app cannot use any UI facilities, and the app must somehow be calling something UI-ish. But I haven't a clue what it might be.
I've worked through most of the notifications, to see if a notification might be lurking in a queue somewhere and doing something, but I've not found anything so far that might be triggering a UI opp.
Any ideas on how to track this down?
Aha!! The app uses an Apple freebee widget known as AQLevelMeter. When recording is stopped, the level meter is also stopped, but the stop code inside AQLevelMeter.mm does not invalidate the timer that's driving the UI updates.
If I have a large file download going on an the app gets moved to background, is there any way to keep the download executing functions alive?
I knowbeginBackgroundTaskWithExpirationHandler: gets called when the app moves to the background and I can start my task there, but I don't want to start a new task, I want to complete my old task. It can be solved with beginBackgroundTaskWithExpirationHandler:, but for that I need to pause my download and resume it from the right place, which is just plain silly.
Ideally what I want is that I wrap my download function with an expiration handler, so my download function keeps executing for the permitted time after the app has been moved to the background.
Ideally what I want is that I wrap my download function with an expiration handler, so my download function keeps executing for the permitted time after the app has been moved to the background.
This is exactly how it works. beginBackgroundTaskWithExpirationHandler: is not called when you enter the background. It's what you call to indicate that you're starting something that, if you happen to go into the background while it's running, you would like to finish. Just wrap your existing download code with beginBackgroundTaskWithExpirationHandler: and endBackgroundTask:.
It is perfectly fine to start a background thread when you're in the forground. Add your custom expiration handler. Do an asynchronous request.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
(unsigned long)NULL), ^(void) {
[self performYourStuffInTheBackGround];
});
And a quote from AppleDEV;
you will probably want to use asynchronous network APIs. iOS provides a wide variety of APIs to do this—from low-level APIs like GCD to high-level APIs like NSURLConnection, with many stops in between—and we encourage you to use them.
I have managed to get seamsless looping of wav files using the SharpDX library.
But this does not seem to work while the app is minimised (in the background).
Using the metro players I do not get a seamless loop this is why I use XAudio2 in the SharpDX library.
Hope someone can help with this.
When your app is in the background it no longer has access to the CPU so your audio will stop playing.
The only way around this is with background agents running the audio component. The issue here is that the certification process will be hard on you if you are just playing looping audio. Playing audio in the background is intended for audio player apps (like the inbuilt "Music" app).
If I were a user of your app I would likely be unhappy that it clogs up the audio system when it isn't in the foreground (if, for example, I went to answer a Lync call). If the only way to stop your app playing audio is to go and turn it off manually or exit the app then my opinion is that the user experience isn't great.
Of course, you may have a different opinion, or your app might be doing something I haven't considered.