How to detect when user enters and exits airplay in tvOS (tvml/tvjs) app - tvos

What event should I be looking for in order to detect when a user interrupts my app by streaming other airplay content to their apple TV.
The more important of these two from my perspective is to detect when the user exits airplay and my app regains 'focus' - but both enter and exit would be useful.

just tested and yes, the onResume and onSuspend callback function is called according to the apple docs:
https://developer.apple.com/documentation/tvmljs/app
I don't think you can tell if it was suspended from Airplay or Siri tho. I would imagine you can add gesture recognizers to see what button is pressed and tell if it was from any of the button clicks.

Related

How to detect if Siri button is clicked from Apple TV Siri Remote

I am clicking on Siri button of Apple TV Siri Remote.
Now, I want Siri to perform action by saying on click of Siri Button of remote within my App.
Is there any way to do it?
No.
Unfortunately, there is no way to detect if the siri button has been clicked.
Clicking the siri button will send your app in background giving the siri process the focus.
I would recommend filling a feature request using their bug report system

SystemMediaTransportControls track name click event

I'm using SystemMediaTransportControls to control audio playback throughout my Windows Phone 8.1 Universal App.
The controls seem to have a one specific behaviour - the track name and artist act as a clickable button and clicking on it fires the OnLaunched event for the app.
Is there any way to either change the behaviour of this button or at least detect if the OnLaunched event is fired due to user clicking on this button?
Specifically, I need to direct the user to the currently playing album's page in the app when she clicks on this button.
The current behavior is that it launches/reactivates the app associated with the background audio playback. The same behavior applies to the Windows Store Music app.
Here's what I think you could try:
If your app has multiple album pages for currently playing audio, then you might consider subscribing to foreground messages from the background task. You can use "BackgroundMediaPlayer.SendMessageToForeground" to send messages to the foreground and navigate appropriately. Try making the call in the OnLaunched event before the Windows is activated. You should also be able to get currently playing audio information and use that accordingly.
Take a look at the Background Audio for Windows Phone 8.1 sample for more details on how to use background audio. Then you should try what I mentioned to see if that works for you.
Hope this helps.

Detecting earphone button press

I am developing a VOIP app based on the VoipChatterbox sample app project and I need to manipulate the headset button click.
I see that, during an active call, when I press the button on the earphone, I get a CallEndRequested event and I need to call NotifyCallEnded within 5 seconds.
But I need a different behavior for my app. I need to simply turn the microphone off / on (toggle behavior) when the user presses the headset button. (This requirement might seem odd, but that's what make sense in the context of my application). How can I achieve this behavior?
To summarize :
Is there any other event to understand that user has pressed the earphone button?
Is there a way to override the behavior that NotifyCallEnded should be called in five seconds when CallEndRequested event is fired?

start application on alarm fires in windows phone 8

I am new to Windows Phone 8 application development and I am creating an application for setting alarm. I have created it and scheduled some alarms . It shows default alarm window with "Dismiss" and "Snooze" buttons. Can I have the provision to override the dismiss and snooze button events from my application. Or can I start my application which set the alarm when the alarm fires? Is anybody knows the answer please help me.
I guess there is no such way to override these buttons for an alarm. But if you are going to use a reminder then you will be able specify a relative navigation URI, and when an user taps on the reminder pop up you could redirect the user to your app.
For more refer here
http://www.geekchamp.com/articles/getting-started-with-windows-phone-alarms
Hope it helps!
You can not Override that butttons but you can have events that are fired when alarm popup opens or dismissed.
Inside your App.Xaml.cs, you can subscribe to the Obscured and Unobscured events of your RootFrame.
RootFrame.Obscured += new EventHandler<ObscuredEventArgs>(RootFrame_Obscured);
RootFrame.Unobscured += new EventHandler(RootFrame_Unobscured);
When the alarm pops up, RootFrame_Unobscured will be fired; after you dismiss it, RootFrame_Obscured will be fired.

Allow my app to be opened with camera button

I'm working on a WP8 app that will utilize the camera for a feature. I've read that, as of GDR2, you can now change which app opens with the camera button, but:
it appears that an app needs to be specially written to be used like
this; not every photo or camera app can be configured to launch when
you press the Camera button.
Question: What do I need to do in my app for it to become an available option in the "Pressing the camera button opens: " drop down when navigating to Settings -> Applications -> photos + camera?
Additionally, part 2 of this question would be (if part 1 is possible), when the application is launching, can I determine if the user opened it via the camera button (so that I could go straight to my camera feature)?
I've seen this article but it only describes how to use and handle the shutter button, it doesn't mention how to allow this button to open the app.
Has anyone been able to accomplish this?
This thread (http://forums.wpcentral.com/windows-phone-8/234751-changing-default-camera-app.html) seems to suggest that only manufacturers can create apps that can do this. Not sure if it's definite, but I've never heard of a 3rd party camera app that can do more than register as a lens.