Tuesday, 5 October 2021

How do I structure an Intent to open a Podcast App using an RSS Feed URL?

I have an app that has dynamic podcast / RSS feed URLs generated by users. For example, let's use this url:

http://leccap.engin.umich.edu/leccap/feed/podcast/sample-rec-7d9gq34m/4

As these URLs are generated on the fly by content creators I need to take the URL that is passed to me by the API and create an intent that opens up a podcast app. While I am not endorsing any of these, in order to provide context, here are some podcast app examples for anyone unfamiliar:

As the intent I am sending could be opened by any / all of these apps, I don't need to support a singular one as much as just figure out the correct Intent builder logic so that the user can choose which one they want to use.

I have this base code setup:

        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        //Setting data / categories here

        this.startActivity(intent);

And I have tried the following variations on the intent categories & data:

        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setDataAndType(Uri.parse(podcastUrl), "*/*");
        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setDataAndType(Uri.parse(podcastUrl), "application/xml");
        intent.addCategory(Intent.CATEGORY_BROWSABLE);
        intent.setData(Uri.parse(podcastUrl));
        intent.setData(Uri.parse(podcastUrl));
        intent.setData(Uri.parse(podcastUrl));
        intent = Intent.createChooser(intent, "Choose a Selection");

none of which work to actually redirect into a native podcast player app via deep linking. I have also tried multiple variations on the category option and none of them seem to improve things.

As per Is there a standard way to subscribe to a feed using a podcast app? I have also tried replacing the http: / https: string with feed and itpc, IE

feed://leccap.engin.umich.edu/leccap/feed/podcast/sample-rec-7d9gq34m/4

And still nothing.

How do I go about structuring this Intent so that it will present the user options to open a Podcast app to handle said feed URL?



from How do I structure an Intent to open a Podcast App using an RSS Feed URL?

No comments:

Post a Comment