P | Cast now has a custom URI scheme

When you want your app to become more popular you could enable other apps to launch your app. You can even go beyond just launching and even activating special features.

As you’ve probably read, P | Cast now has a Car Mode UI built in. So there are apps that are focused on Car Mode, which would want to launch P | Cast in it’s Car Mode. Even more, they might want to even start playing the music directly after launching the app.

That’s why adding a custom URI scheme for P | Cast was on my mind from the beginning, and now it’s there.

The basics of launching P | Cast

You can launch P | Cast in it’s normal UI, but also in Car Mode.

/// <summary>
/// Launch P | Cast in Normal UI
/// </summary>
private void Normal()
{
    Windows.System.Launcher.LaunchUriAsync(new Uri("pcast:NormalPlayer"));
}

/// <summary>
/// Launch P | Cast in Car Mode
/// </summary>
private void Car()
{
    Windows.System.Launcher.LaunchUriAsync(new Uri("pcast:CarPlayer"));
}

 

Launch P | Cast and start playing immediately

When we go beyond the basic launch, we can add a couple of additional URI elements to enable immediate playback on app launch.

To start playing the most recent track upon app launch use the below URIs.

/// <summary>
/// Launch P | Cast in Normal UI and immediately start playing the most recent track
/// </summary>
private void NormalPlayRecent()
{
    Windows.System.Launcher.LaunchUriAsync(new Uri("pcast:NormalPlayer?Play=Recent"));
}

/// <summary>
/// Launch P | Cast in Car Mode and immediately start playing the most recent track
/// </summary>
private void CarPlayRecent()
{
    Windows.System.Launcher.LaunchUriAsync(new Uri("pcast:CarPlayer?Play=Recent"));
}

 

And if you want the app to start playing a random track, use these.

/// <summary>
/// Launch P | Cast in Normal UI and immediately start playing a random track
/// </summary>
private void NormalPlayRandom()
{
    Windows.System.Launcher.LaunchUriAsync(new Uri("pcast:NormalPlayer?Play=Random"));
}

/// <summary>
/// Launch P | Cast in Car Mode and immediately start playing a random track
/// </summary>
private void CarPlayRandom()
{
    Windows.System.Launcher.LaunchUriAsync(new Uri("pcast:CarPlayer?Play=Random"));
}

 

If you’ve questions about integration of P | Cast in your app, please leave a message in the comments or contact me on the P | Cast twitter account.

Gravatar