Back to project page Telecine.
The source code is released under:
Apache License
If you think the Android project Telecine listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jakewharton.telecine; /*ww w . j a va2s. c om*/ import android.app.Activity; import android.content.Intent; import android.media.projection.MediaProjectionManager; import com.google.android.gms.analytics.HitBuilders; import timber.log.Timber; import static android.content.Context.MEDIA_PROJECTION_SERVICE; final class CaptureHelper { private static final int CREATE_SCREEN_CAPTURE = 4242; private CaptureHelper() { throw new AssertionError("No instances."); } static void fireScreenCaptureIntent(Activity activity, Analytics analytics) { MediaProjectionManager manager = (MediaProjectionManager) activity.getSystemService(MEDIA_PROJECTION_SERVICE); Intent intent = manager.createScreenCaptureIntent(); activity.startActivityForResult(intent, CREATE_SCREEN_CAPTURE); analytics.send(new HitBuilders.EventBuilder() // .setCategory(Analytics.CATEGORY_SETTINGS) .setAction(Analytics.ACTION_CAPTURE_INTENT_LAUNCH) .build()); } static boolean handleActivityResult(Activity activity, int requestCode, int resultCode, Intent data, Analytics analytics) { if (requestCode != CREATE_SCREEN_CAPTURE) { return false; } if (resultCode == 0) { Timber.d("Failed to acquire permission to screen capture."); } else { Timber.d("Acquired permission to screen capture. Starting service."); activity.startService(TelecineService.newIntent(activity, resultCode, data)); } analytics.send(new HitBuilders.EventBuilder() // .setCategory(Analytics.CATEGORY_SETTINGS) .setAction(Analytics.ACTION_CAPTURE_INTENT_RESULT) .setValue(resultCode) .build()); return true; } }