Sorry, left out the intent. Updated the code below:

On 24 Feb, 17:29, Fredrik H <fredrik.henrics...@gmail.com> wrote:
> I'm starting the YouTube app with a request code (1) and try to finish
> it after 30 seconds. However, in ICS 4.0.3 the finishActivity call
> does not finish the YouTube app. Logcat output shows nothing related
> to the finishActivity call and onActivityResult in my activity is not
> called. This worked in Gingerbread and I believe it worked in earlier
> versions of ICS. Is there any other way to achieve the same
> functionality?

(mDataSource is a video ID, e.g. y8Kyi0WNg40)

        Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("vnd.youtube:" + mDataSource));
        intent.putExtra("VIDEO_ID", mDataSource);
        final int REQUEST_CODE = 1;
        startActivityForResult(intent, REQUEST_CODE);
        Log.d(LOG_TAG,
                "We sleep for 30 seconds while the video plays and
then close the YouTube app.");
        SystemClock.sleep(30000);

        Log.d(LOG_TAG, "Finishing YouTube app...");
        finishActivity(REQUEST_CODE);

> -F

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to