1

I have a simple issue, when i use

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.

I added the permissions in AndroidManifest.xml as

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

but it is not working still going ask the user to press the call button.Any one have idea of this please help.

Ali.

Ali
  • 835
  • 1
  • 10
  • 23

1 Answers1

5

That should be in your tiapp.xml, slightly differently:

<android xmlns:android="http://schemas.android.com/apk/res/android">
  <manifest>
    <uses-permission android:name="android.permission.CALL_PHONE" />
  </manifest>
</android>

And then use intents to open the dialer:

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

Source: http://shareourideas.com/2012/09/05/appcelerator-titanium-android-click-to-auto-call/

Dawson Toth
  • 5,580
  • 2
  • 22
  • 37
  • Hi Dawson Sorry to bother you again, Actually its not going well and giving me exception again for PERMISSION DENIAL.can you please help me out regarding this.i have setup my tiapp.xml like that what you said and create my intent into my app.js. But unfortunately couldn't get succeed. – Ali Dec 06 '12 at 18:33
  • Look at your generated AndroidManifest.xml and make sure the tag is ending up where it needs to be. http://stackoverflow.com/questions/4275678/how-to-make-phone-call-using-intent-in-android – Dawson Toth Dec 06 '12 at 18:37
  • Hi Dawson, i tried that it is working fine with me now i just want to dial *123*456789# but it shows number till 9 and skips # value.can you please explain what could be the issue or some other solution for that? Thanks again for you help. – Ali Jan 17 '13 at 11:57
  • I think you need to URL encode it (encodeURIComponent('123*456789#123') -- basing this comment on the answer to http://stackoverflow.com/questions/4815785/initiate-a-phone-call-on-android-with-special-character and adjusting for JavaScript instead of Java – Dawson Toth Jan 17 '13 at 14:27