1

I want to call directly, do not showing prompt.

For me I used html5 <a href>, don't know how to set it as directly call when I click the button

call.html

  <div padding class="about-bottom">
    <a ion-button color="light" href="tel:1800889958">
      立即拨打
    </a>
  </div>

call.scss

.about-bottom {
  text-align: center;
  background-color: #F44336;
}

call.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

@Component({
  selector: 'page-call',
  templateUrl: 'call.html'
})
export class CallPage {

  constructor(public navCtrl: NavController) {
  }
}
sebaferreras
  • 44,206
  • 11
  • 116
  • 134
Yuyang He
  • 2,252
  • 4
  • 28
  • 51
  • @sebaferreras help please~~~ – Yuyang He Aug 09 '17 at 02:47
  • 1
    I just saw your comment with my name because I entered to this post, but user mentions on stack overflow does not work like this, I did not receive any notification. So I guess you can just mention someone in the comments (to really be notified) if he has already added an answer. Otherwise the mention won't notify anyone. – sebaferreras Aug 09 '17 at 04:24

1 Answers1

3

Unfortunately, that's not possible, at least in the existing versions of iOS.

Just like you can see in Apple docs:

When a third party application invokes openURL: on a tel://, facetime://, or facetime-audio:// URL, iOS displays a prompt and requires user confirmation before dialing.

So that dialog will always be shown :(

EDIT

The same happens on Android. You can show the dial page with the number already entered, but you can't make the call directly. Since we're using Ionic (and not a native approach) we can ask the underlaying OS to handle the request, but we can't try to make the call directly.

sebaferreras
  • 44,206
  • 11
  • 116
  • 134
  • On Android, does anything happen when you click that button? – sebaferreras Aug 09 '17 at 08:05
  • When I click that button change to calling number page and the number showing in calling number there. – Yuyang He Aug 09 '17 at 08:11
  • Just like you can see in [this SO post](https://stackoverflow.com/questions/16186106/how-to-make-a-call-directly): *It's not possible. This is for user protection.*. So I'm afraid that showing the call page with the number there is the only way to do it. – sebaferreras Aug 09 '17 at 08:15
  • But android native can use 'ACTION_CALL' to derictly call without showing prompt, so ionic framework no some function like this one? – Yuyang He Aug 09 '17 at 08:30
  • 1
    Yeah I know, but since we're using Ionic (and not a native approach) we can ask the underlaying OS to handle the request, but we can't try to call directly. – sebaferreras Aug 10 '17 at 14:37
  • Glad to help :) – sebaferreras Aug 11 '17 at 07:01