Generate the appropriate intent to launch the existing camera application
to capture an image


@see #CAPTURE_PHOTO_REQUEST_CODE
@return          the intent necessary to launch the camera to capture a photo
184817
public static Intent getCameraCaptureIntent(Context ctx, String authority){
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        try {
            // Get the app's local file storage
            mCurrentCaptureUri = createAccessibleTempFile(ctx, authority);
            grantPermissions(ctx, mCurrentCaptureUri);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, mCurrentCaptureUri);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return intent;
    }
772229
public function createAction()
    {
        $this->initializeScaffolding();
        $this->checkRequest();

        try {
            $this->beforeCreate();
            $this->scaffolding->doCreate($this->request->getPost());
            $this->flash->success($this->successMessage);
            return $this->afterCreate();
        } catch (Exception $e) {
            $this->flash->error($e->getMessage());
            $this->afterCreateException();
        }

        return $this->dispatcher->forward(['action' => 'new']);
    }
449455
public static function launchCheck($needed=self::ALL, $session_object=null,$request_data=false) {
        global $TSUGI_LAUNCH, $CFG;
        $needed = self::patchNeeded($needed);

        // Check if we are an LTI 1.1 or LTI 1.3 launch
        $LTI11 = false;
        $LTI13 = false;
        $detail = LTI13::isRequestDetail($request_data);
        if ( $detail === true ) {
            $LTI13 = true;
        } else {
            $lti11_request_data = $request_data;
            if ( $lti11_request_data === false ) $lti11_request_data = self::oauth_parameters();
            $LTI11 = LTI::isRequestCheck($lti11_request_data);
            if ( is_string($LTI11) ) {
                self::abort_with_error_log($LTI11, $request_data);
            }
        }
        if ( $LTI11 === false && $LTI13 === false ) return $detail;


        $session_id = self::setupSession($needed,$session_object,$request_data);
        if ( $session_id === false ) return false;

        // Redirect back to ourselves...
        $url = self::curPageUrl();

        if ( $session_object !== null ) {
            $TSUGI_LAUNCH->redirect_url = self::curPageUrl();
            return true;
        }

        $location = U::addSession($url);
        session_write_close();  // To avoid any race conditions...

        if ( headers_sent() ) {
            echo('<p><a href="'.$url.'">Click to continue</a></p>');
        } else {
            header('Location: '.$location);
        }
        exit();
    }
685051
private void startCameraSource() throws SecurityException {
        // check that the device has play services available.
        int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
                getActivity().getApplicationContext());
        if (code != ConnectionResult.SUCCESS) {
            Dialog dlg =
                    GoogleApiAvailability.getInstance().getErrorDialog(getActivity(), code, RC_HANDLE_GMS);
            dlg.show();
        }

        if (mCameraSource != null) {
            try {
                mPreview.start(mCameraSource, mGraphicOverlay);
            } catch (IOException e) {
                Log.e("BARCODE-SCANNER", "Unable to start camera source.", e);
                mCameraSource.release();
                mCameraSource = null;
                if (mListener != null)
                    mListener.onBarcodeScanningFailed("could not create camera source");
            }
        }
    }
1087565
@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        sessionTracker.getSession().onActivityResult(this.getActivity(), requestCode, resultCode, data);
    }
82217
def on_intent(intent_request, session):
    

    print("on_intent requestId=" + intent_request['requestId'] +
          ", sessionId=" + session['sessionId'])

    intent = intent_request['intent']
    intent_name = intent_request['intent']['name']

    # Dispatch to your skill's intent handlers
    if intent_name == "MyColorIsIntent":
        return set_color_in_session(intent, session)
    elif intent_name == "WhatsMyColorIntent":
        return get_color_from_session(intent, session)
    elif intent_name == "AMAZON.HelpIntent":
        return get_welcome_response()
    elif intent_name == "AMAZON.CancelIntent" or intent_name == "AMAZON.StopIntent":
        return handle_session_end_request()
    else:
        raise ValueError("Invalid intent")
32544
public function send_intent() {
        global $CFG, $DB;
        require_once($CFG->dirroot . '/mnet/xmlrpc/client.php');
        $client = new mnet_xmlrpc_client();
        $client->set_method('portfolio/mahara/lib.php/send_content_intent');
        $client->add_param($this->get('user')->username);
        $this->ensure_mnethost();
        if (!$client->send($this->mnethost)) {
            foreach ($client->error as $errormessage) {
                list($code, $message) = array_map('trim',explode(':', $errormessage, 2));
                $message .= "ERROR $code:<br/>$errormessage<br/>";
            }
            throw new portfolio_export_exception($this->get('exporter'), 'failedtoping', 'portfolio_mahara', '', $message);
        }
        // we should get back... the send type and a shared token
        $response = (object)$client->response;
        if (empty($response->sendtype) || empty($response->token)) {
            throw new portfolio_export_exception($this->get('exporter'), 'senddisallowed', 'portfolio_mahara');
        }
        switch ($response->sendtype) {
            case 'immediate':
                $this->sendtype = PORTFOLIO_MAHARA_IMMEDIATE;
                break;
            case 'queue':
                $this->sendtype = PORTFOLIO_MAHARA_QUEUE;
                break;
            case 'none':
            default:
                throw new portfolio_export_exception($this->get('exporter'), 'senddisallowed', 'portfolio_mahara');
        }
        $this->token = $response->token;
        $this->get('exporter')->save();
        // put the entry in the mahara queue table now too
        $q = new stdClass;
        $q->token = $this->token;
        $q->transferid = $this->get('exporter')->get('id');
        $DB->insert_record('portfolio_mahara_queue', $q);
    }
704338
private void link() {
        synchronized (mDropboxApiLock) {
            if (mDropboxApi != null) {
                final DropboxAPI<AndroidAuthSession> dropboxApi = mDropboxApi;

                mHandler.post(new Runnable() {

                    @Override
                    public void run() {
                        String accountName = null;
                        String shareUrl = null;
                        String accessToken = null;

                        // Request params.
                        synchronized (mDropboxApiLock) {
                            // Create directory for storing photos.
                            if (createPhotoFolder(dropboxApi)) {
                                // Get account params.
                                accountName = requestAccountName(dropboxApi);
                                shareUrl = requestShareUrl(dropboxApi);
                                accessToken = dropboxApi.getSession().getOAuth2AccessToken();
                            }
                        }

                        // Validate account settings and store.
                        Handler uiHandler = new Handler(Looper.getMainLooper());
                        if (accountName != null && accountName.length() > 0 && shareUrl != null
                                && shareUrl.length() > 0 && accessToken != null) {
                            storeAccountParams(accountName, shareUrl, accessToken);

                            // Emit link state change event on ui thread.
                            uiHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    notifyLinkStateChanged(new LinkEvent(true));
                                }
                            });
                        } else {
                            // Handle error on ui thread.
                            uiHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    handleLinkError();
                                }
                            });
                        }
                    }
                });
            }
        }
    }
547249
@Override
  public Response doRequest(final StitchRequest stitchReq) {
    initAppMetadata(clientAppId);

    return super.doRequestUrl(stitchReq, getHostname());
  }
686895
public static ImageRequestBuilder fromRequest(ImageRequest imageRequest) {
    return ImageRequestBuilder.newBuilderWithSource(imageRequest.getSourceUri())
        .setImageDecodeOptions(imageRequest.getImageDecodeOptions())
        .setBytesRange(imageRequest.getBytesRange())
        .setCacheChoice(imageRequest.getCacheChoice())
        .setLocalThumbnailPreviewsEnabled(imageRequest.getLocalThumbnailPreviewsEnabled())
        .setLowestPermittedRequestLevel(imageRequest.getLowestPermittedRequestLevel())
        .setPostprocessor(imageRequest.getPostprocessor())
        .setProgressiveRenderingEnabled(imageRequest.getProgressiveRenderingEnabled())
        .setRequestPriority(imageRequest.getPriority())
        .setResizeOptions(imageRequest.getResizeOptions())
        .setRequestListener(imageRequest.getRequestListener())
        .setRotationOptions(imageRequest.getRotationOptions())
        .setShouldDecodePrefetches(imageRequest.shouldDecodePrefetches());
  }
1339414
function () {
            var self = this;
            var originalCreateAction = self.options.actions.createAction;
            self.options.actions.createAction = function (postData) {
                return $.Deferred(function ($dfd) {

                    var input = $.extend({}, postData);

                    originalCreateAction.method(input)
                        .done(function (result) {
                            $dfd.resolve({
                                "Result": "OK",
                                "Record": originalCreateAction.recordField ? result[originalCreateAction.recordField] : result,
                                originalResult: result
                            });
                        })
                        .fail(function (error) {
                            self._handlerForFailOnAbpRequest($dfd, error);
                        });
                });
            };
        }
728614
def request_frame(self):
        """"""
        self.session_id = get_new_session_id()
        return FrameActivateSceneRequest(scene_id=self.scene_id, session_id=self.session_id)
234604
public static Intent newSelectPictureIntent() {
        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setType("image/*");
        return intent;
    }
962619
private void requestCameraPermission() {
		int permissionCheck = ContextCompat.checkSelfPermission(this,
				Manifest.permission.CAMERA);

		if( permissionCheck != android.content.pm.PackageManager.PERMISSION_GRANTED) {
			ActivityCompat.requestPermissions(this,
					new String[]{Manifest.permission.CAMERA},
					0);
			// a dialog should open and this dialog will resume when a decision has been made
		}
	}
943049
@SuppressLint("NewApi")
    public static void startActivity(Context context, Intent intent,
                                     int requestCode, Bundle options) {
        final Activity activity = context instanceof Activity ? (Activity) context
                : null;
        if (activity != null && HoloEverywhere.ALWAYS_USE_PARENT_THEME) {
            ThemeManager.cloneTheme(activity.getIntent(), intent, true);
        }
        final int parentColorScheme = ThemeManager.getThemeType(activity);
        if (parentColorScheme != INVALID) {
            intent.putExtra(_PARENT_SCHEME_TAG, parentColorScheme);
        }
        if (context instanceof SuperStartActivity) {
            ((SuperStartActivity) context).superStartActivity(intent,
                    requestCode, options);
        } else if (VERSION.SDK_INT >= 16) {
            context.startActivity(intent, options);
        } else {
            context.startActivity(intent);
        }
    }
1187940
public BufferedImage getSnapshot ()
    {
        BufferedImage baseSnap = _base.getSnapshot();
        BufferedImage img = new BufferedImage(_bounds.width, _bounds.height,
            baseSnap.getType());
        Graphics2D gfx = (Graphics2D) img.getGraphics();
        try {
            gfx.transform(_transform);
            gfx.drawImage(baseSnap, 0, 0, null);
        } finally {
            gfx.dispose();
        }
        return img;
    }
1363386
public String captureEntirePageScreenshot() {
        String imageName = generateImageName();
        String imageLink = generateImageLink(imageName);
        try {
            app.takeScreenshot(imageName);
            screenshots.add(imageName);
        } catch (Exception e) {
            log.error(e);
            imageLink = "<br/><b><font class='fail'>No Screenshot Available</font></b>";
        }
        return imageLink;
    }