/* * Send the IncomingCallMessage to the VoiceActivity */ private void sendIncomingCallMessageToActivity(IncomingCallMessage incomingCallMessage, int notificationId) { Intent intent = new Intent(VoiceActivity.ACTION_INCOMING_CALL); intent.putExtra(VoiceActivity.INCOMING_CALL_MESSAGE, incomingCallMessage); intent.putExtra(VoiceActivity.INCOMING_CALL_NOTIFICATION_ID, notificationId); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); }
private void openActivity(string phoneNumber, string method) { Intent verification = new Intent(this, typeof(VerificationActivity)); verification.putExtra(INTENT_PHONENUMBER, phoneNumber); verification.putExtra(INTENT_METHOD, method); startActivity(verification); }
public virtual void showPickerDialog() { Intent intent = new Intent(Activity, typeof(DeviceSelectActivity)); intent.putExtra("deviceType", mType); startActivityForResult(intent, 0); }
/// <summary> /// @brief Starts the activity in the sapa environment /// /// Setup intent by adding custom class loader and extras edit_mode /// TODO: Description on what's the edit_mode /// </summary> /// <param name="mode"> </param> private bool startSapaActivity(string instanceId, int mode) { Context context = Context; Log.d(TAG, "Start sapa app"); Log.d(TAG, "instanceId:" + instanceId); if (null == context) { Log.w(TAG, "Cannot start activity for instance " + instanceId + ": null context"); return(false); } if (null == mSapaServiceConnector) { Log.w(TAG, "Cannot start activity for instance " + instanceId + ": service connector not set to the FC context"); return(false); } Intent intent = mSapaServiceConnector.getLaunchIntent(instanceId); if (null == intent) { Log.w(TAG, "Cannot start activity for instance " + instanceId + ": launch intent is null"); return(false); } intent.ExtrasClassLoader = typeof(SapaAppInfo).ClassLoader; intent.putExtra("Edit_mode", mode); intent.Flags = Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT; context.startActivity(intent); return(true); }
protected internal override void onPostExecute(string token) { outerInstance.mGoogleLoginClicked = false; Intent resultIntent = new Intent(); if (token != null) { resultIntent.putExtra("oauth_token", token); } else if (errorMessage != null) { resultIntent.putExtra("error", errorMessage); } setResult(MainActivity.RC_GOOGLE_LOGIN, resultIntent); finish(); }
protected internal override void onPostExecute(string token) { outerInstance.mGoogleLoginClicked = false; Intent intentWithToken = new Intent(outerInstance, typeof(OfficeMoverActivity)); intentWithToken.putExtra(AUTH_TOKEN_EXTRA, token); startActivity(intentWithToken); }
public override void onIncomingCall(CallClient callClient, Call call) { Log.d(TAG, "onIncomingCall: " + call.CallId); Intent intent = new Intent(outerInstance, typeof(IncomingCallScreenActivity)); intent.putExtra(CALL_ID, call.CallId); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); outerInstance.startActivity(intent); }
private bool sendSapaSwitchBroadcast(string packageName, string instanceId) { Context context = Context; if (null == context) { Log.w(TAG, "Cannot send sapa switch broadcast (pkg: " + packageName + ", instance: " + instanceId + "): context is null"); return(false); } Intent intent = new Intent(FcConstants.INTENT_SAPA_SWITCH); intent.putExtra(FcConstants.INTENT_SAPA_SWITCH_EXTRAS_INSTANCEID, instanceId); intent.putExtra(FcConstants.INTENT_SAPA_SWITCH_EXTRAS_PACKAGE, packageName); context.sendBroadcast(intent, FcConstants.PERMISSION_USE_CONNETION_SERVICE); return(true); }
private void callButtonClicked() { string userName = mCallName.Text.ToString(); if (userName.Length == 0) { Toast.makeText(this, "Please enter a user to call", Toast.LENGTH_LONG).show(); return; } Call call = SinchServiceInterface.callUser(userName); string callId = call.CallId; Intent callScreen = new Intent(this, typeof(CallScreenActivity)); callScreen.putExtra(SinchService.CALL_ID, callId); startActivity(callScreen); }
private void callButtonClicked() { string userName = mCallName.Text.ToString(); if (userName.Length == 0) { Toast.makeText(this, "Please enter a user to call", Toast.LENGTH_LONG).show(); return; } Call call = SinchServiceInterface.callUserVideo(userName); string callId = call.CallId; Intent callScreen = new Intent(this, typeof(CallScreenActivity)); callScreen.putExtra(SinchService.CALL_ID, callId); startActivity(callScreen); }
public override bool shouldOverrideUrlLoading(WebView view, string url) { Log.d(outerInstance.TAG, "Loading URL: " + url); string AIS_REDIRECT_TOKEN = Resources.getString([email protected]_redirect_token); string AIS_DOMAIN = Resources.getString([email protected]_domain); string AIS_WEBVIEW_COOKIE = Resources.getString([email protected]_webview_cookie); // Once we've hit the final redirect URL to complete authentication, // harvest the cookie from this webview and pass it back to the main // activity. if (url.Contains(AIS_REDIRECT_TOKEN) && url.Contains("aisresponse")) { string cookie = CookieManager.Instance.getCookie(AIS_DOMAIN); Intent result = new Intent(outerInstance, typeof(MainActivity)); result.putExtra(AIS_WEBVIEW_COOKIE, cookie); CookieSyncManager.Instance.sync(); setResult(RESULT_OK, result); finish(); return(true); } return(false); }
private void callButtonClicked() { string userName = mCallName.Text.ToString(); if (userName.Length == 0) { Toast.makeText(this, "Please enter a user to call", Toast.LENGTH_LONG).show(); return; } try { Call call = SinchServiceInterface.callUser(userName); string callId = call.CallId; Intent callScreen = new Intent(this, typeof(CallScreenActivity)); callScreen.putExtra(SinchService.CALL_ID, callId); startActivity(callScreen); } catch (MissingPermissionException e) { ActivityCompat.requestPermissions(this, new string[] { e.RequiredPermission }, 0); } }
private void callButtonClicked() { string userName = mCallName.Text.ToString(); if (userName.Length == 0) { Toast.makeText(this, "Please enter a user to call", Toast.LENGTH_LONG).show(); return; } try { Call call = SinchServiceInterface.callUser(userName); string callId = call.CallId; Intent callScreen = new Intent(this, typeof(CallScreenActivity)); callScreen.putExtra(SinchService.CALL_ID, callId); startActivity(callScreen); } catch (MissingPermissionException e) { ActivityCompat.requestPermissions(this, new string[]{e.RequiredPermission}, 0); } }
/* * Show the notification in the Android notification drawer */ //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @TargetApi(android.os.Build.VERSION_CODES.KITKAT_WATCH) private void showNotification(com.twilio.voice.IncomingCallMessage incomingCallMessage, int notificationId) private void showNotification(IncomingCallMessage incomingCallMessage, int notificationId) { string callSid = incomingCallMessage.CallSid; if (!incomingCallMessage.Cancelled) { /* * Create a PendingIntent to specify the action when the notification is * selected in the notification drawer */ Intent intent = new Intent(this, typeof(VoiceActivity)); intent.Action = VoiceActivity.ACTION_INCOMING_CALL; intent.putExtra(VoiceActivity.INCOMING_CALL_MESSAGE, incomingCallMessage); intent.putExtra(VoiceActivity.INCOMING_CALL_NOTIFICATION_ID, notificationId); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); /* * Pass the notification id and call sid to use as an identifier to cancel the * notification later */ Bundle extras = new Bundle(); extras.putInt(NOTIFICATION_ID_KEY, notificationId); extras.putString(CALL_SID_KEY, callSid); /* * Create the notification shown in the notification drawer */ NotificationCompat.Builder notificationBuilder = (new NotificationCompat.Builder(this)).setSmallIcon(R.drawable.ic_call_white_24px).setContentTitle(getString([email protected]_name)).setContentTextuniquetempvar.setAutoCancel(true).setExtras(extras).setContentIntent(pendingIntent).setColor(Color.rgb(214, 10, 37)); notificationManager.notify(notificationId, notificationBuilder.build()); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { /* * If the incoming call was cancelled then remove the notification by matching * it with the call sid from the list of notifications in the notification drawer. */ StatusBarNotification[] activeNotifications = notificationManager.ActiveNotifications; foreach (StatusBarNotification statusBarNotification in activeNotifications) { Notification notification = statusBarNotification.Notification; Bundle extras = notification.extras; string notificationCallSid = extras.getString(CALL_SID_KEY); if (callSid.Equals(notificationCallSid)) { notificationManager.cancel(extras.getInt(NOTIFICATION_ID_KEY)); } } } else { /* * Prior to Android M the notification manager did not provide a list of * active notifications so we lazily clear all the notifications when * receiving a cancelled call. * * In order to properly cancel a notification using * NotificationManager.cancel(notificationId) we should store the call sid & * notification id of any incoming calls using shared preferences or some other form * of persistent storage. */ notificationManager.cancelAll(); } } }
public SearchView(android.content.Context context, android.util.AttributeSet attrs ) : base(context, attrs) { mShowImeRunnable = new _Runnable_137(this); mUpdateDrawableStateRunnable = new _Runnable_148(this); mOnClickListener = new _OnClickListener_787(this); mTextKeyListener = new _OnKeyListener_836(this); mOnEditorActionListener = new _OnEditorActionListener_1059(this); mOnItemClickListener = new _OnItemClickListener_1233(this); mOnItemSelectedListener = new _OnItemSelectedListener_1244(this); mTextWatcher = new _TextWatcher_1530(this); android.view.LayoutInflater inflater = (android.view.LayoutInflater)context.getSystemService (android.content.Context.LAYOUT_INFLATER_SERVICE); inflater.inflate([email protected]_view, this, true); mSearchButton = findViewById([email protected]_button); mQueryTextView = (android.widget.SearchView.SearchAutoComplete)findViewById([email protected] .id.search_src_text); mQueryTextView.setSearchView(this); mSearchEditFrame = findViewById([email protected]_edit_frame); mSearchPlate = findViewById([email protected]_plate); mSubmitArea = findViewById([email protected]_area); mSubmitButton = findViewById([email protected]_go_btn); mCloseButton = (android.widget.ImageView)findViewById([email protected]_close_btn ); mVoiceButton = findViewById([email protected]_voice_btn); mSearchHintIcon = (android.widget.ImageView)findViewById([email protected]_mag_icon ); mSearchButton.setOnClickListener(mOnClickListener); mCloseButton.setOnClickListener(mOnClickListener); mSubmitButton.setOnClickListener(mOnClickListener); mVoiceButton.setOnClickListener(mOnClickListener); mQueryTextView.setOnClickListener(mOnClickListener); mQueryTextView.addTextChangedListener(mTextWatcher); mQueryTextView.setOnEditorActionListener(mOnEditorActionListener); mQueryTextView.setOnItemClickListener(mOnItemClickListener); mQueryTextView.setOnItemSelectedListener(mOnItemSelectedListener); mQueryTextView.setOnKeyListener(mTextKeyListener); mQueryTextView.setOnFocusChangeListener(new _OnFocusChangeListener_265(this)); android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected] .styleable.SearchView, 0, 0); setIconifiedByDefault(a.getBoolean([email protected]_iconifiedByDefault , true)); int maxWidth = a.getDimensionPixelSize([email protected]_maxWidth , -1); if (maxWidth != -1) { setMaxWidth(maxWidth); } java.lang.CharSequence queryHint = a.getText([email protected]_queryHint ); if (!android.text.TextUtils.isEmpty(queryHint)) { setQueryHint(queryHint); } int imeOptions = a.getInt([email protected]_imeOptions, -1 ); if (imeOptions != -1) { setImeOptions(imeOptions); } int inputType = a.getInt([email protected]_inputType, -1); if (inputType != -1) { setInputType(inputType); } a.recycle(); bool focusable = true; a = context.obtainStyledAttributes(attrs, [email protected], 0, 0); focusable = a.getBoolean([email protected]_focusable, focusable); a.recycle(); setFocusable(focusable); mVoiceWebSearchIntent = new android.content.Intent(android.speech.RecognizerIntent .ACTION_WEB_SEARCH); mVoiceWebSearchIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); mVoiceWebSearchIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL , android.speech.RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); mVoiceAppSearchIntent = new android.content.Intent(android.speech.RecognizerIntent .ACTION_RECOGNIZE_SPEECH); mVoiceAppSearchIntent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); mDropDownAnchor = findViewById(mQueryTextView.getDropDownAnchor()); if (mDropDownAnchor != null) { mDropDownAnchor.addOnLayoutChangeListener(new _OnLayoutChangeListener_313(this)); } updateViewsVisibility(mIconifiedByDefault); updateQueryHint(); }
/// <summary> /// Create and return an Intent that can launch the voice search activity, perform a specific /// voice transcription, and forward the results to the searchable activity. /// </summary> /// <remarks> /// Create and return an Intent that can launch the voice search activity, perform a specific /// voice transcription, and forward the results to the searchable activity. /// </remarks> /// <param name="baseIntent">The voice app search intent to start from</param> /// <returns>A completely-configured intent ready to send to the voice search activity /// </returns> private android.content.Intent createVoiceAppSearchIntent(android.content.Intent baseIntent, android.app.SearchableInfo searchable) { android.content.ComponentName searchActivity = searchable.getSearchActivity(); // create the necessary intent to set up a search-and-forward operation // in the voice search system. We have to keep the bundle separate, // because it becomes immutable once it enters the PendingIntent android.content.Intent queryIntent = new android.content.Intent(android.content.Intent .ACTION_SEARCH); queryIntent.setComponent(searchActivity); android.app.PendingIntent pending = android.app.PendingIntent.getActivity(getContext (), 0, queryIntent, android.app.PendingIntent.FLAG_ONE_SHOT); // Now set up the bundle that will be inserted into the pending intent // when it's time to do the search. We always build it here (even if empty) // because the voice search activity will always need to insert "QUERY" into // it anyway. android.os.Bundle queryExtras = new android.os.Bundle(); // Now build the intent to launch the voice search. Add all necessary // extras to launch the voice recognizer, and then all the necessary extras // to forward the results to the searchable activity android.content.Intent voiceIntent = new android.content.Intent(baseIntent); // Add all of the configuration options supplied by the searchable's metadata string languageModel = android.speech.RecognizerIntent.LANGUAGE_MODEL_FREE_FORM; string prompt = null; string language = null; int maxResults = 1; android.content.res.Resources resources = getResources(); if (searchable.getVoiceLanguageModeId() != 0) { languageModel = resources.getString(searchable.getVoiceLanguageModeId()); } if (searchable.getVoicePromptTextId() != 0) { prompt = resources.getString(searchable.getVoicePromptTextId()); } if (searchable.getVoiceLanguageId() != 0) { language = resources.getString(searchable.getVoiceLanguageId()); } if (searchable.getVoiceMaxResults() != 0) { maxResults = searchable.getVoiceMaxResults(); } voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL, languageModel ); voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_PROMPT, prompt); voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE, language); voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_MAX_RESULTS, maxResults ); voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_CALLING_PACKAGE, searchActivity == null ? null : searchActivity.flattenToShortString()); // Add the values that configure forwarding the results voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, pending); voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE , queryExtras); return voiceIntent; }
/// <summary>Create and return an Intent that can launch the voice search activity for web search. /// </summary> /// <remarks>Create and return an Intent that can launch the voice search activity for web search. /// </remarks> private android.content.Intent createVoiceWebSearchIntent(android.content.Intent baseIntent, android.app.SearchableInfo searchable) { android.content.Intent voiceIntent = new android.content.Intent(baseIntent); android.content.ComponentName searchActivity = searchable.getSearchActivity(); voiceIntent.putExtra(android.speech.RecognizerIntent.EXTRA_CALLING_PACKAGE, searchActivity == null ? null : searchActivity.flattenToShortString()); return voiceIntent; }
/// <summary>Constructs an intent from the given information and the search dialog state. /// </summary> /// <remarks>Constructs an intent from the given information and the search dialog state. /// </remarks> /// <param name="action">Intent action.</param> /// <param name="data">Intent data, or <code>null</code>.</param> /// <param name="extraData"> /// Data for /// <see cref="android.app.SearchManager.EXTRA_DATA_KEY">android.app.SearchManager.EXTRA_DATA_KEY /// </see> /// or <code>null</code>. /// </param> /// <param name="query">Intent query, or <code>null</code>.</param> /// <param name="actionKey"> /// The key code of the action key that was pressed, /// or /// <see cref="android.view.KeyEvent.KEYCODE_UNKNOWN">android.view.KeyEvent.KEYCODE_UNKNOWN /// </see> /// if none. /// </param> /// <param name="actionMsg"> /// The message for the action key that was pressed, /// or <code>null</code> if none. /// </param> /// <param name="mode"> /// The search mode, one of the acceptable values for /// <see cref="android.app.SearchManager.SEARCH_MODE">android.app.SearchManager.SEARCH_MODE /// </see> /// , or /// <code>null</code> /// . /// </param> /// <returns>The intent.</returns> private android.content.Intent createIntent(string action, System.Uri data, string extraData, string query, int actionKey, string actionMsg) { // Now build the Intent android.content.Intent intent = new android.content.Intent(action); intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); // We need CLEAR_TOP to avoid reusing an old task that has other activities // on top of the one we want. We don't want to do this in in-app search though, // as it can be destructive to the activity stack. if (data != null) { intent.setData(data); } intent.putExtra(android.app.SearchManager.USER_QUERY, mUserQuery); if (query != null) { intent.putExtra(android.app.SearchManager.QUERY, query); } if (extraData != null) { intent.putExtra(android.app.SearchManager.EXTRA_DATA_KEY, extraData); } if (mAppSearchData != null) { intent.putExtra(android.app.SearchManager.APP_DATA, mAppSearchData); } if (actionKey != android.view.KeyEvent.KEYCODE_UNKNOWN) { intent.putExtra(android.app.SearchManager.ACTION_KEY, actionKey); intent.putExtra(android.app.SearchManager.ACTION_MSG, actionMsg); } intent.setComponent(mSearchable.getSearchActivity()); return intent; }