当前位置: 首页>>代码示例>>Java>>正文


Java Intent.ACTION_CALL属性代码示例

本文整理汇总了Java中android.content.Intent.ACTION_CALL属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_CALL属性的具体用法?Java Intent.ACTION_CALL怎么用?Java Intent.ACTION_CALL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.content.Intent的用法示例。


在下文中一共展示了Intent.ACTION_CALL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemClick

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Bundle bundle = new Bundle();
    String phoneNumber = ((TextView)view.findViewById(R.id.item_room)).getText().toString();
    //String treatment = ((TextView)v.findViewById(R.id.item_name)).getText().toString();
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
    // Here, thisActivity is the current activity
    if (ContextCompat.checkSelfPermission(getContext(), android.Manifest.permission.CALL_PHONE)
            != PackageManager.PERMISSION_GRANTED) {

        ActivityCompat.requestPermissions(getActivity(),
                new String[]{android.Manifest.permission.CALL_PHONE},
                MY_PERMISSIONS_REQUEST_CALL_PHONE);

        // MY_PERMISSIONS_REQUEST_CALL_PHONE is an
        // app-defined int constant. The callback method gets the
        // result of the request.
    } else {
        //You already have permission
        try {
            startActivity(intent);
        } catch(SecurityException e) {
            e.printStackTrace();
        }
    }
    startActivity(intent);
}
 
开发者ID:Harrix,项目名称:uchimznaem-helper,代码行数:27,代码来源:ContactsFragment.java

示例2: callPhone

/**
 * 拨打电话
 */
public static void callPhone(Activity activity, String phone) {
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone));
    if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
        PermissionUtil.applyPermission(activity, Manifest.permission.CALL_PHONE, 100);
        return;
    }
    activity.startActivity(intent);
}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:11,代码来源:PhoneUtil.java

示例3: calling

public void calling() {
    Log.d(TAG, "Calling");

    if (!validate()) {
        onCallFailed();
        return;
    }

    _callButton.setEnabled(false);

    final ProgressDialog progressDialog = new ProgressDialog(Call.this,
            R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("Залгаж байна...");
    progressDialog.show();
    new android.os.Handler().postDelayed(
            new Runnable() {
                public void run() {
                    onCallSuccess();
                    progressDialog.dismiss();
                }
            }, 3000);
    String phoneNumber = _phoneText.getText().toString();
    Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+phoneNumber));
    startActivity(callIntent);
}
 
开发者ID:tortuvshin,项目名称:actions,代码行数:26,代码来源:Call.java

示例4: onClick

@Override
public void onClick(View view) {
    String nbr = (String) view.getTag();
    if (!TextUtils.isEmpty(nbr)) {
        SipProfile acc = mAccountChooserButton.getSelectedAccount();
        Intent it = new Intent(Intent.ACTION_CALL);
        it.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, nbr));
        it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        it.putExtra(SipProfile.FIELD_ACC_ID, acc.id);
        startActivity(it);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:12,代码来源:CallLogDetailsFragment.java

示例5: cancelIfBusy

@ReactMethod
public void cancelIfBusy() {
    String uri = "tel:" + Uri.encode("##67#");
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    this.reactContext.startActivity(intent);
}
 
开发者ID:himelbrand,项目名称:react-native-forward-calls,代码行数:8,代码来源:RNForwardCallsModule.java

示例6: call

/**
 * сделать вызов по телефону
 * необходимо разрешение на звонки на Android 6+!
 *
 * @param context     Контекст
 * @param phoneNumber номер телефона
 */
@SuppressWarnings("MissingPermission")
public static void call(Context context, @Nullable String phoneNumber) {
    if (!TextUtils.isEmpty(phoneNumber)) {
        Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        if (intent.resolveActivity(context.getPackageManager()) != null) {
            context.startActivity(intent);
        } else {
            Toast.makeText(context, R.string.error_dont_have_call_app, Toast.LENGTH_SHORT)
                    .show();
        }
    }
}
 
开发者ID:interactiveservices,项目名称:utils-android,代码行数:20,代码来源:IntentUtils.java

示例7: immediatePhoneCall

@ReactMethod
public void immediatePhoneCall(String number) {
    number = Uri.encode(number);
    String url = "tel:" + number;
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    this.reactContext.startActivity(intent);
}
 
开发者ID:wumke,项目名称:react-native-immediate-phone-call,代码行数:8,代码来源:RNImmediatePhoneCallModule.java

示例8: cancelIfNotAnswered

@ReactMethod
public void cancelIfNotAnswered() {
    String uri = "tel:" + Uri.encode("##61#");
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    this.reactContext.startActivity(intent);
}
 
开发者ID:himelbrand,项目名称:react-native-forward-calls,代码行数:8,代码来源:RNForwardCallsModule.java

示例9: callPhone

public static void callPhone(Context ctx, String phoneNumber) {
    if (ctx == null) {
        return;
    }
    if (phoneNumber == null || phoneNumber.isEmpty()) {
        return;
    }
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"
            + phoneNumber));

    ctx.startActivity(intent);
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:12,代码来源:IMUIHelper.java

示例10: cancelUnconditional

@ReactMethod
public void cancelUnconditional() {
    String uri = "tel:" + Uri.encode("##21#");
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    this.reactContext.startActivity(intent);
}
 
开发者ID:himelbrand,项目名称:react-native-forward-calls,代码行数:8,代码来源:RNForwardCallsModule.java

示例11: cancelAllConditional

@ReactMethod
public void cancelAllConditional() {
    String uri = "tel:" + Uri.encode("##002#");
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    this.reactContext.startActivity(intent);
}
 
开发者ID:himelbrand,项目名称:react-native-forward-calls,代码行数:8,代码来源:RNForwardCallsModule.java

示例12: call

private void call(int i)
{
    String phone;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && checkSelfPermission(android.Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
        requestPermissions(new String[]{android.Manifest.permission.CALL_PHONE}, PERMISSIONS_REQUEST_PHONE_CALL);
    }
    else{
        phone = number[i];
        Intent intent = new Intent(Intent.ACTION_CALL);
        intent.setData(Uri.parse("tel:+91" + phone));
        startActivity(intent);
    }

}
 
开发者ID:appteam-nith,项目名称:Nimbus,代码行数:14,代码来源:MainActivity.java

示例13: onReceive

@Override
public void onReceive(Context context, Intent intent) {
	if(SipManager.ACTION_GET_PHONE_HANDLERS.equals(intent.getAction())) {
		
		PendingIntent pendingIntent = null;
		String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
		// We must handle that clean way cause when call just to 
		// get the row in account list expect this to reply correctly
		if(number != null && PhoneCapabilityTester.isPhone(context)) {
			// Build pending intent
			Intent i = new Intent(Intent.ACTION_CALL);
			i.setData(Uri.fromParts("tel", number, null));
			pendingIntent = PendingIntent.getActivity(context, 0, i, 0);
		}
		
		// Retrieve and cache infos from the phone app 
		if(!sPhoneAppInfoLoaded) {
   			List<ResolveInfo> callers = PhoneCapabilityTester.resolveActivitiesForPriviledgedCall(context);
   			if(callers != null) {
   				for(final ResolveInfo caller : callers) {
   					if(caller.activityInfo.packageName.startsWith("com.android")) {
   						PackageManager pm = context.getPackageManager();
   						Resources remoteRes;
   						try {
   							// We load the resource in the context of the remote app to have a bitmap to return.
   						    remoteRes = pm.getResourcesForApplication(caller.activityInfo.applicationInfo);
   						    sPhoneAppBmp = BitmapFactory.decodeResource(remoteRes, caller.getIconResource());
   						} catch (NameNotFoundException e) {
   							Log.e(THIS_FILE, "Impossible to load ", e);
   						}
   						break;
   					}
   				}
   			}
   			sPhoneAppInfoLoaded = true;
		}
		
		
		//Build the result for the row (label, icon, pending intent, and excluded phone number)
		Bundle results = getResultExtras(true);
		if(pendingIntent != null) {
			results.putParcelable(CallHandlerPlugin.EXTRA_REMOTE_INTENT_TOKEN, pendingIntent);
		}
		results.putString(Intent.EXTRA_TITLE, context.getResources().getString(R.string.use_pstn));
		if(sPhoneAppBmp != null) {
			results.putParcelable(Intent.EXTRA_SHORTCUT_ICON, sPhoneAppBmp);
		}
		
		// This will exclude next time tel:xxx is raised from csipsimple treatment which is wanted
		results.putString(Intent.EXTRA_PHONE_NUMBER, number);
		
	}
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:53,代码来源:CallHandler.java

示例14: makePhoneCall

public static void makePhoneCall(Context context, String phoneNumber) {
  if (null != phoneNumber && phoneNumber.length() > 0) {
    Uri phoneUri = Uri.parse("tel:" + phoneNumber);   // Could also use Uri.Builder
    Intent intent = new Intent(Intent.ACTION_CALL, phoneUri);
    context.startActivity(intent);
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:7,代码来源:PhoneCallUtil.java

示例15: forwardCallsIfBusy

@ReactMethod
public void forwardCallsIfBusy(String phoneNumber) {
  String uri = "tel:**67*" + Uri.encode(phoneNumber+"#");
  Intent intent = new Intent(Intent.ACTION_CALL);
  intent.setData(Uri.parse(uri));
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  this.reactContext.startActivity(intent);
}
 
开发者ID:himelbrand,项目名称:react-native-forward-calls,代码行数:8,代码来源:RNForwardCallsModule.java


注:本文中的android.content.Intent.ACTION_CALL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。