拨打911的安卓 [英] Call 911 in Android

查看:128
本文介绍了拨打911的安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Android的SDK来拨打急救电话

我使用下面的code呼叫的电话号码(911)。这code工作正常,除了911(紧急Nuumber)所有的数字。当我用911,然后它表明我不想拨号屏幕。有没有什么方法拨打911没有打开拨号程序,或者我们可以阻止用户编辑在拨号屏幕的数量。

 乌里callUri = Uri.parse(电话:// 911);
意图callIntent =新的意图(Intent.ACTION_DIAL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);
 

解决方案

规定应该已经对这项工作的code,但你需要的CALL_PHONE和CALL_PRIVILEGED允许拨打紧急号码,而不显示拨号盘。

<一个href="http://developer.android.com/reference/android/Manifest.permission.html#CALL_PRIVILEGED">Android参考 - 舱单权限CALL_PRIVILEGED

一旦被添加到清单,你应该能够使用ACTION_CALL,而不是直接使用相同的code拨打:

 乌里callUri = Uri.parse(电话:// 911);
意图callIntent =新的意图(Intent.ACTION_CALL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);
 

I want to Call Emergency number using android SDK

I am using following code to Call the number(911). This code works fine for all the numbers except 911(Emergency Nuumber). When i use 911 then It shows the dialer screen that i don't want. Is there any procedure to Call 911 without open the dialer or Can we stop the user to edit the number in Dialer screen.

Uri callUri = Uri.parse("tel://911");
Intent callIntent = new Intent(Intent.ACTION_DIAL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);

解决方案

The code provided should already work for this, but you need the CALL_PHONE and CALL_PRIVILEGED permission to dial emergency numbers without showing the dial-pad.

Android Reference - Manifest Permission CALL_PRIVILEGED

Once that is added to the manifest, you should be able to use the same code using the ACTION_CALL instead to direct dial:

Uri callUri = Uri.parse("tel://911");
Intent callIntent = new Intent(Intent.ACTION_CALL,callUri);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
startActivity(callIntent);

这篇关于拨打911的安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆