Search code examples
androidandroid-intenturivine

Open Vine profile from Android app


I'm trying to open the Vine (https://vine.co/) Android app to a specific profile page via code. I've been trying the usual method, via URI with no luck. Here is my current non-functional code:

public void vineButtonClicked(View view)
{
    Intent vineIntent = getVineIntent(view.getContext(), VINE_PROFILE_ID);

    try {
        startActivity(vineIntent);          
    } catch(Exception e) {
        // getVineIntent() doesn't fail on returning a new intent with 
        // the vine:// URI, so this catches the failed intent.  Why 
        // doesn't getVineIntent fail?
        Toast.makeText(view.getContext(), "Vine is not installed!", Toast.LENGTH_SHORT).show();
    }
}

public Intent getVineIntent(Context context, String userProfile) {
    try {
         return new Intent(Intent.ACTION_VIEW,
                 Uri.parse("vine://user/".concat(userProfile)));
    } catch (Exception e) {
        return getWebViewIntent("http://vine.co");
    }
}

I tried swapping vine:// for a twitter:// URI scheme and it worked as expected. How can I make this work?


Solution

  • Why doesn't getVineIntent fail?

    Why would it? All you are doing is constructing an Intent.

    How can I make this work?

    Get a job at Vine and add support for vine:// Uri values in some app. Apparently, you do not have an app that responds to such a Uri, and I am assuming that you already have some Vine client installed on your device.