0

This code takes me to the browser, I have the vimeo application, how can it go to the vimeo application?

vimeo1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://player.vimeo.com/video/83178705?"));
                startActivity(browserIntent);
            }
        });

EDITED

vimeo1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                try{
                     Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                     Uri.parse("http://player.vimeo.com/video/83178705"));
                     browserIntent.setPackage("com.vimeo.android.videoapp");
                     startActivity(browserIntent);
                  }
                catch(Exception e){
                    // App is not Installed
                    //Navigate to Play Store or display message                         
                }

            }
        });
Roa
  • 109
  • 7

3 Answers3

1

With the official Vimeo app you can do this:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://player.vimeo.com/video/83178705")));

While this looks almost identical to your code, aside from lack of a ?, on my Android phone it works fine (opens the Vimeo app).

Christian Stewart
  • 15,217
  • 20
  • 82
  • 139
  • I changed it, it went to the browser, I removed the startActivity(browserIntent); iy also went to the browser ... it didn't work, can you please write the entire Java code? – Roa Mar 04 '16 at 04:59
  • Are you sure you have the official Vimeo client installed and have opened / used it before? It just seems like it hasn't registered its url handler yet. – Christian Stewart Mar 04 '16 at 05:01
1

We actually recently made a vimeo-deeplink-android library which should help you achieve exactly what you're looking to do.

You could include it with gradle:

compile 'com.vimeo.android.deeplink:vimeo-deeplink:1.0.0'

And then deeplink to your video with this method:

boolean handled = VimeoDeeplink.showVideoWithUri(Context context, String videoUri)

Where videoUri is equal to /videos/83178705.

Kyle Venn
  • 4,597
  • 27
  • 41
0

Try this, set package name while Re-directing.

catch block will be called if no app is installed related to that package.

try{
     Intent browserIntent = new Intent(Intent.ACTION_VIEW,
     Uri.parse("http://player.vimeo.com/video/83178705"));
     browserIntent.setPackage("com.vimeo.android.videoapp");
     startActivity(browserIntent);
  }
catch(Exception e){
    // App is not Installed
    //Navigate to Play Store or display message                         
}

Edit

I have checked this and you were right its not working. I changed into my code. Now its opening Application but video is not running, I don't know why. Check this updated code.

try{
   Intent browserIntent = null;
   PackageManager pmi = getPackageManager();
   browserIntent =     pmi.getLaunchIntentForPackage("com.vimeo.android.videoapp");
   browserIntent.setAction(Intent.ACTION_VIEW);
   browserIntent.setData(Uri.parse("http://player.vimeo.com/video/83178705"));

   startActivity(browserIntent);
}
catch(Exception e){
   // App is not Installed
   //Navigate to Play Store or display message
   Toast.makeText(MainActivity.this, "In Catch Block", Toast.LENGTH_SHORT).show();
}
Anuj Sharma
  • 4,294
  • 2
  • 37
  • 53