5 Replies Latest reply: Jun 18, 2012 12:35 PM by Denis T RSS

    Can I make a phone call using DeviceDataControl?

    940981
      In my app, I use DeviceDataControl to send SMS and Email, but I can not find any method to make a phone call.

      Does ADF mobile provide the function, which just dial the number?
        • 1. Re: Can I make a phone call using DeviceDataControl?
          Denis T
          The easiest way to do this is to add a "goLink" component with the url attribute to something like "tel:650-555-1212". That will dial the phone.
          • 2. Re: Can I make a phone call using DeviceDataControl?
            940981
            Thanks for the answer.

            Now the other question related to the phone call: can I invoke a phone in backbean? I want to let user to click one button, then in the back bean to retrieve the telephone number, then dial the number, is this realisable?
            • 3. Re: Can I make a phone call using DeviceDataControl?
              Denis T
              Unfortunately I can't think of an easy way to do this. You would have to execute your backing bean as the page is loading (use an action binding and an invokeAction) and then use an EL expression in the goLink that uses the data setup in the bean. Then the data is already there by the time they click the button. Would that work for you?
              • 4. Re: Can I make a phone call using DeviceDataControl?
                940981
                I think I should explain my problem in detail:

                First I realize the phone call by golink as your suggestion, it runs well:

                <amx:goLink id="goLink1" text="#{bindings.telephone.inputValue}" url="tel:#{bindings.telephone.inputValue}"/>

                But the customer want to click the button instead a link, so I use commandbutton + action in the backbean:

                *<amx:commandButton id="commandButton6" text="Call #{bindings.telephone.inputValue}"*
                *inlineStyle="width: 150px;" actionListener="#{bindings.call.execute}">*
                <amx:setPropertyListener from="#{bindings.telephone.inputValue}" to="#{pageFlowScope.callNumber}"
                type="action"/>
                </amx:commandButton>

                public String call(String callNumber) {
                return "tel:" + callNumber; *// doesn't work!*
                }

                Unfortunately return "tel:12345" doesn't make a phone call. I'd like to know how can I dial the number in the back bean, in the call() method?
                • 5. Re: Can I make a phone call using DeviceDataControl?
                  Denis T
                  There is no way programmatically to make a call in a backing bean like this. With the current framework you must use goLink.

                  You said the customer wants to click a button, is that just because they want it to look like a button? If so, I suggest you still use a goLink but add a custom style class to it. You can include your own custom CSS style by either going to the features.xml and using the "includes" or using the skinning framework (check the SkinningDemo that is part of the samples.zip). Then you can simply add that style and make the goLink look like a button.