当前位置:首页 » 安卓系统 » android开发拨号

android开发拨号

发布时间: 2022-04-27 18:05:38

Ⅰ Android实现拨号功能

请检查你这个activity的permission,有没有加上以下的设置。
在AndroidManifest.xml里面添加。

<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />

另外帮你贴下android自带拨号程序的核心部分,请自己参照下吧~~
public class OutgoingCallBroadcaster extends Activity {

private static final String PERMISSION = android.Manifest.permission.PROCESS_OUTGOING_CALLS;
private static final String TAG = "OutgoingCallBroadcaster";
private static final boolean LOGV = true;//Config.LOGV;

public static final String EXTRA_ALREADY_CALLED = "android.phone.extra.ALREADY_CALLED";
public static final String EXTRA_ORIGINAL_URI = "android.phone.extra.ORIGINAL_URI";

private Phone mPhone;

@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);

mPhone = PhoneApp.getInstance().phone;

Intent intent = getIntent();
if (LOGV) Log.v(TAG, "onCreate: Got intent " + intent + ".");

String action = intent.getAction();
String number = PhoneNumberUtils.getNumberFromIntent(intent, this);
if (number != null) {
number = PhoneNumberUtils.stripSeparators(number);
}
final boolean emergencyNumber =
(number != null) && PhoneNumberUtils.isEmergencyNumber(number);

boolean callNow;

if (getClass().getName().equals(intent.getComponent().getClassName())) {
// If we were launched directly from the OutgoingCallBroadcaster,
// not one of its more privileged aliases, then make sure that
// only the non-privileged actions are allowed.
if (!Intent.ACTION_CALL.equals(intent.getAction())) {
Log.w(TAG, "Attempt to deliver non-CALL action; forcing to CALL");
intent.setAction(Intent.ACTION_CALL);
}
}

/* Change CALL_PRIVILEGED into CALL or CALL_EMERGENCY as needed. */
if (Intent.ACTION_CALL_PRIVILEGED.equals(action)) {
action = emergencyNumber
? Intent.ACTION_CALL_EMERGENCY
: Intent.ACTION_CALL;
intent.setAction(action);
}

if (Intent.ACTION_CALL.equals(action)) {
if (emergencyNumber) {
finish();
return;
}
callNow = false;
} else if (Intent.ACTION_CALL_EMERGENCY.equals(action)) {
if (!emergencyNumber) {
finish();
return;
}
callNow = true;
} else {
finish();
return;
}

// Make sure the screen is turned on. This is probably the right
// thing to do, and more importantly it works around an issue in the
// activity manager where we will not launch activities consistently
// when the screen is off (since it is trying to keep them paused
// and has... issues).
//
// Also, this ensures the device stays awake while doing the following
// broadcast; technically we should be holding a wake lock here
// as well.
PhoneApp.getInstance().wakeUpScreen();

/* If number is null, we're probably trying to call a non-existent voicemail number or
* something else fishy. Whatever the problem, there's no number, so there's no point
* in allowing apps to modify the number. */
if (number == null || TextUtils.isEmpty(number)) callNow = true;

if (callNow) {
intent.setClass(this, InCallScreen.class);
startActivity(intent);
}

Intent broadcastIntent = new Intent(Intent.ACTION_NEW_OUTGOING_CALL);
if (number != null) broadcastIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
broadcastIntent.putExtra(EXTRA_ALREADY_CALLED, callNow);
broadcastIntent.putExtra(EXTRA_ORIGINAL_URI, intent.getData().toString());
broadcastIntent.putExtra(EXTRA_INTENT_FROM_BT_HANDSFREE,
intent.getBooleanExtra(OutgoingCallBroadcaster.EXTRA_INTENT_FROM_BT_HANDSFREE, false));

if (LOGV) Log.v(TAG, "Broadcasting intent " + broadcastIntent + ".");
sendOrderedBroadcast(broadcastIntent, PERMISSION, null, null,
Activity.RESULT_OK, number, null);

finish();
}

}

Ⅱ 安卓开发拨号器出错闪退

你好。你的手机内存不足。清理一下把。望采纳 是的 我也喜欢2011版的安卓系统4.0以上不能用。会闪退,不过有修改版的,修改的不好不稳定,你可以到网络上找修改版的

Ⅲ android开发怎么实现拨号拼音检索联系人的功能

不能~一般只能开头那个字的大写
“张小军”
就输入Z就检测出来选项选择

Ⅳ Android开发,设计如下一个手机拨号界面,要求使用动态添加按钮以及绑定响应函数。

童鞋,你上的是刘宁的专选吧~

Ⅳ android开发怎么拨打电话

无权限版(弹出拨号界面并自动输入电话号码,用户选择是否拨号):

java">importandroid.content.Context;
importandroid.content.Intent;
importandroid.net.Uri;
publicvoidCall(StringNum,Contextc){
if(Num!=null&&Num.length()>0){
Intentitt=newIntent(Intent.ACTION_DIAL,Uri.parse("tel:"+Num));
itt.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
c.startActivity(itt);
}
}

权限版(弹出拨号界面,自动输入电话号码并立刻拨号,在部分系统中会触发安全警告):

<!---权限--->
<uses-permissionandroid:name="android.permission.CALL_PHONE"/>
importandroid.content.Context;
importandroid.content.Intent;
importandroid.net.Uri;
publicvoidCall(StringNum,Contextc){
if(Num!=null&&Num.length()>0){
Intentitt=newIntent(Intent.ACTION_CALL,Uri.parse("tel:"+Num));
itt.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
c.startActivity(itt);
}
}

Ⅵ 安卓开发 如何替换安卓系统默认的拨号程序

这个怎么可能会默认打开某个拨号程序呢?

这是个系统拨号inten如果某个界面声明接收这个intent
就可以打开这个界面
如果一个手机有多个接收拨打电话的intent且没有选择默认程序的情况下会出现选择框,如果已经选择了默认程序可以直接打开默认程序
正常代码不可能直接修改系统的设置,除非你获得root权限在修改内存数据去.
或者让用户点击你的按钮那样才能行

Ⅶ 在android开发中,如何实现一键拨号。是用“intent”然后调用数据库中的号码来实现吗

是先获得存储的号码,然后把号码作为Intent中的参数,启动拨号应用来实现的一键拨号。

Ⅷ android开发,如何启动自己的拨号面板

有action属性设置。不需要你关键的

Ⅸ android 开发制作通讯录,怎么实现按拨号键对当前联系人拨号

通讯录是用listview做的吗?如果是那么用拨号键的button对象setTag吧电话号存起来,然后在监听事件内取出来,这样就能保证每一行的号码都是相对应的了。例如。。
btn.setTag(p.telephone);
btn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + v.getTag()));
startActivity(intent);
}
});

Ⅹ Android开发简单拨号器实现

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}

/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.fragment_main, container,
false);

Button mbutton = (Button)rootView.findViewById(R.id.button1);

mbutton.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

EditText mEditText = (EditText)rootView.findViewById(R.id.edittext);
String number = mEditText.getText().toString();
Intent intent = new Intent();
intent.setAction("android.intent.action.CALL");
intent.addCategory("android.intent.category.DEFAULT");
intent.setData(Uri.parse("tel:" + number));
startActivity(intent);

TextView mtext = (TextView)rootView.findViewById(R.id.text2);
mtext.setText("按钮事件启动了");

}
} );

return rootView;
}
}

}

这是我使用4.4版本下开发的一个电话拨号器的java代码,你看看,希望能帮到你,电话启动代码写到PlaceholderFragment里

热点内容
如何重置手机密码realme 发布:2024-05-06 14:57:25 浏览:347
自己搭建外网服务器违法吗 发布:2024-05-06 14:56:32 浏览:629
苹果安卓哪个步数准确 发布:2024-05-06 14:43:58 浏览:239
安卓手机软件用什么编程语言写 发布:2024-05-06 14:30:07 浏览:657
des解密python 发布:2024-05-06 14:30:06 浏览:684
n的阶乘算法 发布:2024-05-06 14:29:57 浏览:552
安卓手机为什么停服 发布:2024-05-06 14:29:08 浏览:93
电脑服务器不运行是怎么回事 发布:2024-05-06 14:20:28 浏览:791
肥皂板解压视频大全 发布:2024-05-06 14:20:27 浏览:260
ps4各个服务器有什么区别 发布:2024-05-06 14:10:38 浏览:485