Windows Phone, Navigate to MusicPlayer - c#

I'm developing WP application, part of which is to play/stream audio files.
I didn't wanted to create my own page to display info of current playing track, so I decided to use Built-in Music's player, using Microsoft.Xna.Framework.Media.MediaPlayer class I created playlists and queued playback. It all works fine, but now I need to navigate to MusicPlayer, when user taps on track in my app, and that's the part I've no idea what to do.
I've tried to navigate to MusicPlayer using Microsoft.Phone.Tasks.MediaPlayerLauncher, but it's not an option, because it...
Needs to receive media location in IsolatedStorage, which means
streaming is impossible
Gets one media at a time, so no playlists
I guess I can't navigate without changing track(or starting over)
Is there any way to navigate to Built-in Music Player's Now Playing page, without interrupting playback?

I think these questions might be helpful/related to what you're looking for:
Detecting and launching an external application from within a Windows Phone 7.1/7.5 application
Launching other applications in Windows phone 7 Programatically
In short, it doesn't seem like third-party apps have permission to access other apps on the phone, probably for security reasons.

Related

How to detect if another application's audio is playing in background? (UWP, Windows 10)

I am writing a C# SDK (to be used by UWP Publishers) and would like to detect if another application (Pandora, Spotify, Amazon Music, etc.) is playing music in the background, so that I can mute my SDK's sounds.
This comment to this question seems to indicate that I can use BackgroundMediaPlayer.IsMediaPlaying(), but when I play Pandora in a web browser, or the Amazon Music App, this method seems to always return false when music is playing in another app.
This answer to this question seems to indicate that we used to be able to use Microsoft.Xna.Framework.Media.MediaPlayer.State to detect if another app was playing background music, but I don't believe this call is not available in UWP (please let me know if I'm wrong -- I mainly care about this working on Desktop and XBox One).
So my question is, how can I determine if another app (on desktop or in web browser or on Windows phone) is playing music?
I believe the BackgroundMediaPlayer.IsMediaPlaying detects audio playing from WinRT/UWP apps only and not Win32 apps. This API was important for apps on Mobile because you were only allowed to have one app with background audio at any given time. I don't think there is a way to detect this for Win32 apps at this time.
The BackgroundMediaPlayer.IsMediaPlaying method is now obsolete. I've noticed that if background music is playing in UWP, calls to Microsoft.Xna.Framework.Media.MediaPlayer.Play succeed but do not actually play any music, so it seems the check is not necessary in some cases.

How to handle the Keyboard music shortcuts (play/pause/previous/next) in UWP?

I'm developing a Music player app for UWP which can play music in background.
Note that I'm using old 2 layer music app pattern one for foreground and one for background music.
In the app i want to handle the Keyboard music controls like Play, Pause, Next and Previous. can anyone help me out with proper way of implementing the keyboard music controls?
The keyboard shortcuts such as Play, Pauseand so on you mean here are actually the System Media Transport Controls(SMTC).
can anyone help me out with proper way of implementing the keyboard music controls?
Actually, starting with Windows 10, version 1607, UWP apps that use the MediaPlayer class to play media are automatically integrated with the SMTC by default. Simply instantiate a new instance of MediaPlayer and assign a MediaSource, MediaPlaybackItem, or MediaPlaybackList to the player's Source property and the user will see your app name in the SMTC and can play, pause, and move through your playback lists by using the SMTC controls.
This is the recommended way of interacting with the SMTC for most scenarios.Details please reference Integrate with the System Media Transport Controls. There are a few scenarios where you may need to implement manual control of the SMTC. For this please reference Manual control of the System Media Transport Controls.
but i need it to work even in background.
According to the remark section of SystemMediaTransportControls class:
The system transport control allows a user to control a music application that is in the background as well as get and set the current information on which track is playing.
So that SMTC should also work for music in background.
For a sample please reference the official sample.

Desktop Integration in Universal Windows App

Im trying to develop an app for Windows 10 which I hope to submit to the store. I want to get access to the Taskbar APIs so I can set the progress level (green bar behind the process text).
In Windows 7 I used the some of these APIs:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd391692(v=vs.85).aspx
They were wrapped by this handy library which I used in my C# app:
http://blogs.microsoft.co.il/sasha/2009/02/12/windows-7-taskbar-apis/
I cant find the equvilant for UWA Desktop Extension, Any ideas?
Mike
Basically the images are comes from the app asserts, see this: Guidelines for app assets Target-based assets session for more information. The asserts are the read-only stuff and we cannot programmatically change from the code, which means we cannot create the animation on taskbar.
The APIs like ITaskbarList3 are not available in Windows Universal App.
Basically base on my understanding, Microsoft wants to use push notification/live tile also badge to deliver the current state like current progress.

can my windows phone application auto start?

Is there a way for my application to auto-start after some time instead of a notification? Or am I constrained to just notifications?
The difference between Android and Windows Phone (you mentioned Android in your comment) is that Android allows you to do pretty much everything while Windows Phone is a very restricted system. So, unfortunately, the answer is no. (There are ways to launch your app from other places than the app's tile, though. See the end of the answer)
Why am I saying unfortunately? Of course, Windows Phone is a nice and seek operating system that runs wonderful even on low-spec devices like the Lumia 520. But that doesn't mean developers shouldn't get the freedom to interact with the Operating System and do innovative tasks.
But there are reasons Microsoft chose not to allow Autostart (or at least, restrict the area an app can access, not the autostart in particular):
it may irritate customers. Even if you show a message box, many customers just dismiss it without reading it and they wouldn't understand why an app would appear without their interaction
each feature would make the operating system slower and bigger. I don't want to say that an autostart makes the phone unusable, but here's a question: Do you need to run a registry cleaner on you PC from time to time? Yes, you do need to do so You even need to reinstall a PC form time to time. You don't need to do that on a Windows Phone. It just works and will always work (OK, that's maybe a bit too optimistic, but you get it...)
I also don't think an autostart is particularly useful on a mobile. Because each app runs full screen, the system would boot up to your app instead of to the start screen. I don't think the user will always want your app (most of the time, he'll want to look at his start screen or launch another app), so it would just be annoying. On a PC, you can use the auto start for small programs that should run in the background (for example, I've got a progamm that provides Git with my SSH keys that automatically starts up each time).
But as I mentioned above, there are other ways to launch your app. Using url schemes can be surprisingly powerful as you can put a button on a web page that will directly launch your app. Other apps will also be able to launch your app. But as it is not directly what you wanted to know, I won't explain it in detail and instead provide you wiht a gread link to msdn: Auto-launching apps using file and URI associations for Windows Phone 8
For such features you should look into: Windows Embedded 8.1 Handheld instead of the consumer version Windows Phone 8.1.

How to keep you Windows Phone 7.5 application on top

we are creating a windows Phone 7.5 application, this application is developed for specific purpose for company field employes, phones will contain the data sim. No communication allowed like making a phone call, sending sms or chekcing and repling email etc. This application will receive the Push Notifications from our application in the head office.
Is there any way that we can keep this application always on top, regardless what button is pressed by the user we want this application to always stay on top so what ever the notification it receive it will always disply it to the user for futher action.
Thanks
This requirement is not really feasible for a couple of reasons. First, what you are describing actually breaks most of the concepts that a certified app is required to follow. A subset of certification details can be found here: http://msdn.microsoft.com/en-us/library/hh184840(v=vs.92).aspx
Secondly, even if you planned to override the back button (possible) there really is no way to override the Windows, search or camera button at the OS level.
Best of luck!
Short answer: you can't. Application switching is part of the OS, and you don't have control over it.
Best workaround is to pin the app to start and allow it to do background processing with updates to the live tile.
If it's an absolute requirement, you'll have to jailbreak the phone and install your own OS on it.

Categories