IP Address From Javascript to AB Variable


Adrian Brookbank
Hi David,

How can I retrieve IP info for device from javascript variable.

Am able to obtain IP within JS alert fine, but can't seem to get into AB variable..

Have tried $rootscope method, but it doesn't seem to grab the IP from that.

Plugin am using is...

https://github.com/salbahra/cordova-plugin-networkinterface

Thanks for your help,


DecSoft

Hello Adrian,

Yes; please, read this tutorial from the AB help. Go ahead if you have any further question then.



Adrian Brookbank
Perfect, sorted. Was missing the window.App from Rootscope reference. Thanks,

DecSoft

Your're welcome! :-)



Tinn Aphopchung
I have a question.How to integrate this service to AB? I need a sample. I try to add.. noname_down it not work.

DecSoft

Hello to all,

Please, Tin,, use new threads for new questions. If I am not wrong, certainly, we can use the script in the way that you wanted, and, also by call to the URL using an HTTP client control (probably better). However, in both cases we have the same problem: the server disallow the call from the app due to the CORS permissions, and we need that permissions in order to work on it.

A possible solution can be to prepare a script in your own app's server and use that script from your app: by an HTTP client control, just as you already know. The only thing you must to do is an HTTP call from your server's script to the URL of the service, so you can get the IP and then send back to the app.

Another possible solution (depend on your target platforms) can be to use the plugin that is mentioned in this thread by Adrian, so you can get the IP using this way instead the service's URL that you are trying to use now.


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.