在不打开拨号盘的情况下拨打钛金属号码

Ali*_*Ali 1 android titanium appcelerator

当我使用时,我有一个简单的问题

var phone_number='12346789';

Titanium.Platform.openURL('tel:'+phone_number);

   it goes to dial pad in android i want it to directly dial the call without prompting the user to press the call button.
Run Code Online (Sandbox Code Playgroud)

我在AndroidManifest.xml中添加了权限

<uses-permission android:name="android.permission.CALL_PHONE" />
Run Code Online (Sandbox Code Playgroud)

但它还没有工作仍然要求用户按下通话按钮.任何人都有这个想法请帮助.

阿里.

Daw*_*oth 5

这应该在你的tiapp.xml中,略有不同:

<android xmlns:android="http://schemas.android.com/apk/res/android">
  <manifest>
    <uses-permission android:name="android.permission.CALL_PHONE" />
  </manifest>
</android>
Run Code Online (Sandbox Code Playgroud)

然后使用意图打开拨号器:

var intent = Ti.Android.createIntent({
    action: Ti.Android.ACTION_CALL,
    data: 'tel:1234567'
});
Ti.Android.currentActivity.startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

资料来源:http://shareourideas.com/2012/09/05/appcelerator-titanium-android-click-to-auto-call/