Start a new topic

make phone call

make phone call


dear support,

 

Can you tell me how to make a phone call with onClick function or onEnterFieldOfView ? I can't find the answer in the documentation.

 

Thanks.

 

 

this is not directly supported in our SDK, as it focuses on the Augmented Reality part. However you can easily achieve that in your own application, by calling a url that starts with architectsdk:// . Please have a look at the SDK documentation on how you can react on these urls from inside your native application.

E.g. it would be possible to call

...onClick = function() { document.location = "architectsdk://call?number=123456789"; }

-> on the native side register for ArchitectURL callbacks, and on callback

1. parse url
2. dial the number

 

Dear Wolfgang,

 

 

 

Thank you very much. This is what I was looking for.

 

 

regard,

 

Ollivier.

Hi Wolf,

would you please provide sample code for dialing phone call? in the native side register for ArchitectURL callbacks, and on callback

1. parse url
2. dial the number

I'm not understand this part, i'm newer

Thans

Sunk

Dear Sunk,

 

For android or iOS ?

 

Olivier.

Android 2.3

HTML Side:

in the createTracker() :

 

 

var callUs = new AR.ImageResource(imagesPath + "callUs.jpg", {onError: function(){error("callUs")}, onLoaded: function(){loaded("callUs")}});

var callUsOverlay = new AR.ImageDrawable(callUs, 1.0, {zOrder: 0, onClick: function() {makeACall("+123456789")}});

 

 

 

//define new function

function makeACall(number)

{

    var id = 3;

    document.location = "architectsdk://handleCommand?id="+id+"&number="+number;

}

 

 

Native Side:

 

Implements the urlWasInvoked function (do not forget to register: this.architectView.registerUrlListener( this ); in onCreate).

 

Declare constant attribut:

 

 

private static String makeACallCommand = "3";//choose the value you want

 

 

public boolean urlWasInvoked( String url ) {

 

     boolean res = false;

     List<NameValuePair> queryParams = URLEncodedUtils.parse( URI.create( url ), "UTF-8" );

 

     String id = "";

     // getting the values of the contained GET-parameters

     for ( NameValuePair pair : queryParams )

     {

        if ( pair.getName().equals( "id" ) )

        {

           id = pair.getValue();

        }

     }

 

     if(id.equals(makeACallCommand))

     {

          NameValuePair p = queryParams.get(1);

          String number = p.getValue();

 

          Intent intent = new Intent(Intent.ACTION_CALL);

 

          intent.setData(Uri.parse("tel:+" + number));

          startActivity(intent);

 

         res = true;

    }

 

     return res;

}

 

Olivier.

Hello,

does not work, I get the following message: "Page not available".

I'm trying the sample html. Any solutions?

regards

have you tried what Olivier suggested, which sums it up very good.

If the problem persists after rechecking with the above sample. Please provide your source code and/or a minimal sample that reproduces your problem.

Hi I tried that code Olivier, when I click I get an error "page not available, it is possible that the web page architectsdk:/ /handleCommand?id=3&number=+123456789 service is outside". some solution?

 

is the url you posted exactly the same url output in the error?

If so, the error is in the URL. It should not contain any space between the slashes.

architectsdk:/ /handle...
//should be
architectsdk://handle...

 

sorry to be a mistake to write, if the URL has no spaces, that's no problem

Hi Agustin,

Please have a look at the SimpleARBrowser sample provided in the SDK bundle - It also uses the same mechanism.
Also ensure you register the UrlListener properly right after creating the ARchitectView and escape invalid characters when setting document.location value.

Kind regards,
Andreas

 
Login or Signup to post a comment