简体   繁体   English

在Android Dialer中检查号码

[英]Check a number in Android Dialer

I have to develop a dialer app for android for my company to make use of our internal voip system. 我必须为我的公司开发适用于android的Dialer应用程序,以利用我们的内部voip系统。 i'm totally new to android, but have experience in titanium. 我对android完全陌生,但是有钛的经验。

The app should capture the number and has to perform certain checks on the number. 该应用程序应捕获该号码,并且必须对该号码执行某些检查。 after the checks the standard phone app should dial the number. 检查后,标准电话应用程序应拨打该号码。

Registering a broadcastreceiver is not an option, as this activity has to start on user input/decision 注册广播接收器不是一种选择,因为此活动必须从用户输入/决定开始

For this case I have an the following manifest: 对于这种情况,我有以下清单:

<activity android:name="CallerActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="android.intent.action.CALL_PRIVILEGED" /> 
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="tel" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.CALL" /> 
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="tel" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.CALL_BUTTON" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.CALL" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/phone" />
            <data android:mimeType="vnd.android.cursor.item/phone_v2" />
            <data android:mimeType="vnd.android.cursor.item/person" />
        </intent-filter>
    </activity>
</application>

that works as expected. 如预期般运作。 My app shows up as a dialing option. 我的应用程序显示为拨号选项。 and then in my activity I've the following code: 然后在我的活动中,输入以下代码:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent i = getIntent();
    final Uri number = i.getData();
    number = checkNumberInternal(number);

    Intent dial = new Intent(Intent.ACTION_CALL, number);
    dial.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(dial);
}

The code actually works, but the only problem is, that the default dial options dialog pops up again and again. 该代码实际上有效,但是唯一的问题是,默认拨号选项对话框一次又一次地弹出。

the app has to be without any UI 该应用必须没有任何用户界面

Code is fine. 代码很好。 Use the below Code just before your application tag in the manifest file. 在清单文件中的应用程序标记之前使用以下代码。 Works fine now without opening the default call options popup.Let me know if u still find any issues: 现在可以正常工作而无需打开默认的呼叫选项弹出窗口。让我知道您是否仍然发现任何问题:

<uses-permission android:name="android.permission.CALL_PHONE" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM