How to receive youtube link on sharing?

Hi people,

I am trying to receive youtube link from youtube app. I tried “WebIntent” plugin. I can see my app on Youtube’s sharing menu however I don’t know how to receive that link in my app ?
Is it possible ? Can you please help me ?

Thanks…

Ekrem

Have you tried the onNewIntent() function?

https://github.com/Initsogar/cordova-webintent#onnewintent

import {WebIntent} from 'ionic-native';

WebIntent.onNewIntent()....

Yes , I took an apk and I tried like that:

var newIntent = WebIntent.onNewIntent();
alert(newIntent);

when I shared a video from the Youtube app , he didn’t give an alert on my phone.

You need to do it like this

WebIntent.onNewIntent().then(
    url => {
        alert(url);
    },
    err => {
        alert(err);
    }
);

According to the docs, it returns a Promise

Thanks a lot my friend. I tried this one but it is returning the url as null or ’ '.

Where am I supposed to add this code to keep it always running? For example, when I run my app and share a video from Youtube, the ‘alert’ runs only once.

I haven’t used this before, but I’m assuming in your app constructor. As to why it’s empty, I can’t tell you :confused: Sorry

1 Like