Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
tyler_tu
Posts: 26
Registered: ‎06-17-2013
My Device: Z10

networkAccessible always returns QNetworkAccessManager::NotAccessible after few connection switching

[ Edited ]

Hello

 

I have the following line in the constructor in a httpTransporter class

 

     p_network_access_manager_ = new QNetworkAccessManager(this);

 

And the app calls this everytime before sends any http requests.

 

     QNetworkConfigurationManager manager;

     p_network_access_manager_->setConfiguration(manager.defaultConfiguration());

     int accessible = p_network_access_manager_->networkAccessible();

 

It works well in normal cases until our QA runs into an exteme case of network connection switching in the following steps:

1. Go into an area with both WIFI and Carrier Data
2. Lose the wifi through unplugging the router
3. Start the router up again but leave the data cable out, which makes it no internet connection via wifi
4. Once connected to the Wifi, turn off the carrier data
5. After turning off the carrier data, plug in the data cable again
6. Fire a request

 

As long as going into this state, networkAccessible() will always return QNetworkAccessManager::NotAccessible unless users close and restart the app.

 

The same steps won't affect the web browser, but will keep the embedded webview in the app from accessing the network until restarting the app.

 

Thanks,

 

Tyler

BlackBerry Development Advisor
sabdelsayed
Posts: 249
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10

Re: networkAccessible always returns QNetworkAccessManager::NotAccessible after few connection switching

Hi tyler_tu,

 

It could be a bug with the SDK. Please open a jira ticket here: https://www.blackberry.com/jira/secure/Dashboard.jspa with the details below so that our internal teams start investigating the issue.

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Contributor
tyler_tu
Posts: 26
Registered: ‎06-17-2013
My Device: Z10

Re: networkAccessible always returns QNetworkAccessManager::NotAccessible after few connection switching

Thanks Samar,

 

I opened the jira ticket

 

https://www.blackberry.com/jira/browse/BBTEN-1918

 

Please help to assign it to your internal team.

 

Thanks,

 

Tyler

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: networkAccessible always returns QNetworkAccessManager::NotAccessible after few connection switching

you could try if the lower level APIs also have this issue.

 

init with:

bps_initialize();
subscribe(netstatus_get_domain());
netstatus_request_events(0);

 and in the event method:

if (bps_event_get_domain(event) == netstatus_get_domain()) {
bool netAvail = false;
netstatus_get_availability(&netAvail);

 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
tyler_tu
Posts: 26
Registered: ‎06-17-2013
My Device: Z10

Re: networkAccessible always returns QNetworkAccessManager::NotAccessible after few connection switching

Thanks Simon,

 

I implemented the test code and found the behaviour of the bps api is slightly different from QNetworkAccessManager::networkAccessible does.

 

After running the same steps, netstatus_get_availablility return a false, which is incorrect.  However, after I did a few times of switches between wifi and carrier data in the setting menu, it returns the correct value.

BlackBerry Development Advisor
sabdelsayed
Posts: 249
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10

Re: networkAccessible always returns QNetworkAccessManager::NotAccessible after few connection switching

Thanks tyler_tu for opening the jira ticket. I have escalated it to an internal defect and provided there the related internal issue ID for further reference.

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker