How to get console.log() outputs from a BlackBerry device? - blackberry

I want to debug an application running on the device. I found this for tablets:
http://devblog.blackberry.com/2011/06/debugging-blackberry-web-apps/
I'm looking to do the same thing for BlackBerry smartphones.
In particular:
How can find the IP address of my phone? I can see the device is connected to my PC in Device Manager, but how can I get the IP address?
How can I enable Web Inspector on my phone? I'm using a 9790 on OS7. Couldn't find the same options described in the article above on my device.

- To find your IP Address: If your BB is only connected to 3G network, it will not have an active IP address, but if you connect via Wi-Fi, it will be assigned an IP address (except when that network does not use DHCP - not so often). Suppose that your device has an IP and you want to see it. Try opening Option menu -> Device -> Device and Status Information. Your IP should be displayed there. If it's 0.0.0.0, your device does not have an active IP.
- To open Web Inspector: Open your browser -> Menu -> Options -> Enable Developer Tools. Save it. Tap the Menu again -> Developer Tools –> Enable Web Inspector. A popup shows you your IP address for your Web Inspector session. Next, open Safari and type your URL including your given IP address and port number. Those tabs on your BlackBerry Browser are shown with links. Click on any of those to open Web Inspector.
Hope it helps.

Related

How to present guest Wi-Fi "terms & conditions" confirmation dialog programmatically?

It is typical setup in bars / restaurants / airports where password-free Wi-Fi is available but requires accepting terms & conditions.
First time customer manually connects to Wi-Fi network which brings confirmation dialog and he accepts it. As result internet connection is alive, no problem here.
However next time customer visits the same place iOS device automatically connects to the known Wi-Fi and shows active Wi-Fi connection icon in status bar. But internet connection isn't available until customer accepts terms & conditions again. To do that customer has to either go to iOS settings or open Safari which brings confirmation dialog automatically.
Our app is designed for bars. Based on above iOS behavior regular customer sees that it has Wi-Fi connection in iPhone status bar, yet our app says "No internet connection". Combined this is very confusing UX.
Question: Is there programatic way to bring Wi-Fi confirmation dialog the same way as Safari does?
iOS should do this automatically if your captive portal is configured correctly.
When it connects to a WiFi network, iOS checks to see if http://captive.apple.com returns "success". If it does then it assumes that it has Internet access. If it returns any other content then it assumes that there is a captive portal and it will open the captive portal authentication screen.
This behaviour is independent of whether the user has connected to that hotspot previously.
Where there can be an issue is when the hotspot de-authenticates the user after some time, as iOS does not continually re-try http://captive.apple.com once it has connected successfully.
Your app can periodically check that http://captive.apple.com returns the correct response and open an SFSafariViewController if it doesn't

iPhone/ Android will not dismiss wifi landing page implemented with DNS

I am trying to implement a splash page/ wifi landing page on my existing public wifi network, using the DNS method mentioned in Wiki, in which I host a custom DNS server, that will redirect ALL dns lookup to a local address where a web server is hosted, for all user before they click agree.
After the user clicked agree, my custom DNS server starts returning correct ip for the look up, thus, user will be able to get online.
note: We totally understand that this is in no way secure our network, and even putting our network at risk. But the goal here is to just to pop the landing page up in front of our users.
This approach actually works on Windows Phone (Windows 8 I tested) as splash page, and even on a computer when I try to open a random website, it redirects me to my page, and after I hit agree, I can get to the internet.
When I try it on iPhone/ Android, once I connect to the hotspot, the splash page/ wifi landing page appear as expected (because the device is trying to verify internet access by going to the set of pages) However, after I click agree, and allow internet access, both iPhone and Android splash screen will not go away. I have to force iphone to "use this wifi without network" to exit.
I wonder if there is a special (javascript?) method I can call in the page, or some package I need to send to the device? I noticed on iOS, if I click a link to the App Store, the splash page go away without disconnecting from the network, So, I guess I am missing something here.
For example, clicking the link to the iOS StackOverflow App on iOS device can be a workaround.
Had been googling around for a week now, nothing seems to came up.
by the way, I am building my custom dns server on node js, with the module dnsd.
=-=-=
=-=-=-=-= edit =-=-=-=-=-=
I also uploaded a demo of my code on GitHub:
https://github.com/kylelam/dnsd_wifi
To test it, run it in your local network (sudo node demo.js). Then, change your phone's dns to your machine's IP. Disconnect your phone from wifi and connect to it again. (on iOS, you might need to go into detail, and enable auto-login, and auto-join, or if you can't, just reboot.)
*note1: the server will need to run on port 53, and 80, so it need sudo.
*note2: please don't laugh at my code, I'm very new to this. But please do point out.
*note3: you will need to npm install these packages: os, express, dns, dnsd
ttl set to 0 might be the cause of the issue, try a different value like 5.

How did a Captive Portal force to open a browser

I've setup a Captive Portal with dd-wrt, wifidog, authpuppy and some plugins from authpuppy as well as my own web app.
I am wondering what's the exact thing that will trigger a
browser on the client device to popup?
Is the popup browser from iPhone/iPad a regular browser mode?
It seems some JavaScript will fail on the browser mode, like the shake.js,
event though iOS Safari version is > 4.2.1 from https://github.com/alexgibson/shake.js/
P.S.:
I've done the research like
http://en.wikipedia.org/wiki/Captive_portal
https://personaltelco.net/wiki/CaptivePortal
they don't talk much about the popup browser.
Could anyone help?
If you will try to see the network statistics [request/response] you will find out that devices like ios and android both of them continuously hits some particular urls [in case of android it is www.google.com/generate_204 , don't remember exact url for ios]. These url are generated by system internally. These pings let their server know about various details. So as soon as ios gets connected with a captive portal it tries to hit the system generated url, failing to which it understands that this is packet level protected network and open the browser.
Hope this helps.

Internet connection for third party app in blackberry

Is there any specific settings for third party app using internet connection because when i try lo login,app need network connection and it ask for APN.
I gave APN as "blackberry.net" as given by vodafone but it gives me "tunnel failure error" or "DNS error"
What settings are required so that third party apps can use internet
This is not a programming question.
If you are trying to use a third party app, and you are not able to (tunnel failure) set the apn in your phone in the following way.
Some third-party applications might require a direct TCP or HTTP connection to the Internet. For example, a stock price application might require a connection to the Internet to retrieve the latest stock prices. The TCP settings might be required for the third-party application to access the Internet.
Note: Contact your wireless service provider to obtain the Access Point Name (APN), user name, and password.
On the Home screen of the BlackBerry smartphone, click Options.
Note: Depending on the theme running on your BlackBerry smartphone, you may need to click Settings, then Options.
Complete one of the following:
For BlackBerry® Device Software version 4.1 or later, click Advanced Options > TCP/IP
For BlackBerry Device Software version 4.0 or earlier, click TCP/IP.
Enter the APN, user name, and password obtained from your wireless service provider.
Press the Menu key and select Save.
This information is from here
Try using "WWW" as access point for Vodafone. if still not proper check out for connection types. or just add ";deviceside=true" at the end of your url.

Unable to work with the static IP with my blackberry project

I have done a project where the mobile sends it's latitude and longitude to the server every 15mins. To connect with the server every time i used to enter the IP address of the server dynamically in my application. Whenever i tick an option in my app mobile sends an notification to the server with the details of the option that i checked(Check Box) and everything is working fine. I used the code like below:
String url="http://"+ipaddr+"/SFTS/updateLocation.jsp?empid="+empid+"&lat="+lat+"&lon="+lon+";interface=wifi";
Now i got a new Internet connection with static IP. And now i unable to send the notification to the server. When i am checking a checkbox it is displaying nothing either in the server or client. I tried using deviceside=true; deviceside=false but all my attempts are in vain. What is the problem here? Please kindly help me
The problem is with the apn. We should include ;deviceside=true;apn=airtelgprs.com in the url is the first option or go to Options -> advanced Options -> TCP/IP -> check the option APN Settings Enabled and give APN: airtelgprs.com. It works fine

Resources