iOS Question perform a call from the app? b4i

Discussion in 'iOS Questions' started by ilan, Dec 8, 2014.

  1. ilan

    ilan Expert Licensed User

    hi,

    does anyone know if its possible to perform a call from the app by pressing on a button??

    thanx
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use App.OpenUrl("tel:122121212").
    Make sure to first check App.CanOpenUrl("tel:").

    You can replace tel with telprompt if you want the user to be able to cancel the call before leaving your app.
     
    naifnas and ilan like this.
  3. ilan

    ilan Expert Licensed User

    thanx erel, i must tell you i really enjoy b4i, this is a wonderfull tool. i never thought it would be so easy to develop for ios

    the only thing i really hate on b4i is that i cannot stand up from my pc :D (i am officially addicted to b4i)
     
    karld, stevel05 and Erel like this.
  4. Shay

    Shay Well-Known Member Licensed User

    How to I put <VAR> string instead of the number you wrote?
    is this will work?
    If App.CanOpenURL("tel:") Then App.OpenURL("tel:" & Number )
     
  5. ilan

    ilan Expert Licensed User

    Yes it should work, i do it like this:

    Code:
    Dim phonenumber As String 
    phonenumber = 
    "0505552222"

    If App.CanOpenUrl("telprompt:" & phonenumber) = True Then
        App.OpenURL(
    "telprompt:" & phonenumber)
    End If
     
  6. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Thank you Erel.I have think B4i is the best
     
  7. Taha

    Taha Member Licensed User

    I've got unexpected error: "LaunchServices: ERROR: There is no registered handler for URL scheme (null)". Added this line but without success.
    Code:
    #QueriesSchemes: tel
     
  8. Taha

    Taha Member Licensed User

    Ok, the issue could be resolved by modifying the above code as follows:
    Code:
    Dim phonenumber As String
    phonenumber = 
    "telprompt:0505552222"

    If App.CanOpenUrl(phonenumber) = True Then
        App.OpenURL(phonenumber)
    End If
    Also, removed spaces and parenthesis.
     
  9. manolitoGnet

    manolitoGnet Member Licensed User

    Knows anybody if this error is related to the use of the emulator?

    -canOpenURL: failed for URL: "tel:632222222" - error: "This app is not allowed to query for scheme tel"

    Code:
    Sub Button1_click
        
    Private phonenumber As String
       
        phonenumber = 
    "tel:632222222"

        
    If App.CanOpenUrl(phonenumber) = True Then
               App.OpenURL(phonenumber)
        
    End If
    End Sub
    Tx
     
  10. manolitoGnet

    manolitoGnet Member Licensed User

    An now: -canOpenURL: failed for URL: "tel:632222222" - error: "(null)"

    :(
     
  11. DYL15

    DYL15 New Member Licensed User

    Add
    Code:
    #QueriesSchemes: tel
    to your app to allow it to call.
     
  12. manolitoGnet

    manolitoGnet Member Licensed User

    tx DYL15, but that is done from the begining...
     
  13. ilan

    ilan Expert Licensed User

    just remove "tel:" from your phone number
     
  14. manolitoGnet

    manolitoGnet Member Licensed User

    No, this is not the way...

    Code:
    -canOpenURL: failed for URL: "632222222" - error: "Invalid input URL"
    The protocol is a must.

    Tx
     
  15. ilan

    ilan Expert Licensed User

    have you seen my post above??

    this is how i do it:

    Code:
    Dim phonenumber As String
    phonenumber = 
    "0505552222"

    If App.CanOpenUrl("telprompt:" & phonenumber) = True Then
        App.OpenURL(
    "telprompt:" & phonenumber)
    End If
     
  16. ilan

    ilan Expert Licensed User

    now i see that u r using an emulator. i dont think that phone calls can be performed from an emulator!!
    you should try your code on a real phone
     
  17. manolitoGnet

    manolitoGnet Member Licensed User

    Yeah, that is my very first question... I have not an iPhone, only 4 iPad and the Simulator from Xcode.

    Thanks for your effort!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice