×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    16

    How can I set the best one access point as default

    I use Qt mobility to set a default access point for my app.
    1. The access point menu always popups three times when the app runs.It should popup once,shouldn't it? anybody can tell me why? the code is following:
    QNetworkConfigurationManager manager;

    QNetworkConfiguration defaultIap = manager.defaultConfiguration();

    QNetworkSession* session = new QNetworkSession(defaultIap,this);
    session->open();

    2. If I want app choose the best one access point and starts it by itself ,instead of user choose access point.
    Long time ago, I used XQAccessPointManager class to choose the best one access point automatically. the following is the code:
    apManager = new XQAccessPointManager(this);
    //Get the preferred access point
    XQAccessPoint ap = apManager->preferredAccessPoint();
    // Use the preferred access point if there is one
    if (!ap.isNull())
    {
    apManager->setDefaultAccessPoint(ap);
    }


    But I don't know how can I get the same result(get the preferred access point and set it as default access point) in qt Mobility?

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: How can I set the best one access point as default

    Code I've used:

    Code:
    	QNetworkConfiguration cfg = manager.defaultConfiguration();
    	if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) {
    		QMessageBox::information(this, "", tr("Available Access Points not found."));
    		return;
    	}
    	
    	if (cfg.type() == QNetworkConfiguration::UserChoice) {
    		QNetworkConfiguration::StateFlags flags = QNetworkConfiguration::Discovered | QNetworkConfiguration::Active;
    		QList<QNetworkConfiguration> allCfg = manager.allConfigurations(flags);
    		// Just take the first one
    		if (allCfg.count() > 0) {
    			cfg = allCfg.at(0); 
    		}
    	}
    But I'm just using the first available configuration, vs selecting between them somehow.

  3. #3
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    31

    Re: How can I set the best one access point as default

    You cannot set the default access point. That's considered to be a platform choice. You can change this via the Symbian connection/access point management tools. Every application should honour the platform default. otherwise we end up with myriads of defaults (one per application) which means that the user does not have certainty about what's going to be used. Furthermore your application would change the default for all other applications.

    If you really believe that your application requires a different access point you almost always want to consult the user about it. If that's the case you can of course popup a dialog asking the user and then you remember the access point.

    If no default is set defaultConfiguration() returns a UserChoice configuration which causes the platform to popup a dialog asking what the user might want to use. As part of this dialog you may even be able to set the default. However always keep in mind that this behavior is determined by the platform and has nothing to do with Moiblity. Mobility simply receives the result of the user selection.
    Last edited by AlexBl; 2010-04-30 at 00:20.

  4. #4
    Registered User
    Join Date
    Nov 2009
    Posts
    16

    Re: How can I set the best one access point as default

    Thanks guy,I think "manager.defaultConfiguration()" was really effective for my app. but I don't know the access point menu always popups three times when the app runs.It should popup once and then system will save the choice as default,shouldn't it?

  5. #5
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    31

    Re: How can I set the best one access point as default

    It should popup for each time you call QNetworkSession:pen(). If you close the session and later reopen using the same configuration you will retrigger the popup.

    if you want to remember to which config the user chose you can enquire about it using QNetworkSession::sessionProperty(UserChoiceConfiguration).

    For details see: http://doc.qt.nokia.com/qtmobility-1...essionProperty

  6. #6
    Registered User
    Join Date
    Nov 2009
    Posts
    16

    Re: How can I set the best one access point as default

    Quote Originally Posted by AlexBl View Post
    It should popup for each time you call QNetworkSession:pen(). If you close the session and later reopen using the same configuration you will retrigger the popup.

    if you want to remember to which config the user chose you can enquire about it using QNetworkSession::sessionProperty(UserChoiceConfiguration).

    For details see: http://doc.qt.nokia.com/qtmobility-1...essionProperty
    Am I right?
    QNetworkConfigurationManager manager;
    QNetworkConfiguration defaultIap = manager.defaultConfiguration();

    QNetworkSession* session = new QNetworkSession(defaultIap,this);

    QString ident = session->sessionProperty("ActiveConfiguration").toString();
    defaultIap.children().contains( manager.configurationFromIdentifier(ident) );
    session->open();

  7. #7
    Nokia Developer Expert
    Join Date
    Dec 2009
    Posts
    31

    Re: How can I set the best one access point as default

    As mentioned in other threads you cannot set the defaultConfiguration as this would have side effects on all other apps on the device. Every 5.0 and 3.2 device has a defaultConfiguration. This issue should only happen on 3.1 devices. There are a couple of workarounds:

    1.) A workaround for 3.1 could be to use QNetworkConfiguration::allCOnfigurations(), display it to the user, let him chose and remember what he chose.

    2.) Call QNetworkSession:pen() which should trigger the popup dialog. Once the opened() signal has fired enquie about the ActiveConfiguration via the session property and remember it. Next time your application opens ask for defaultConfiguration() and if it is still a UserChoice you use the former configuration (assuming that its state is still active).

  8. #8
    Registered User
    Join Date
    Nov 2009
    Posts
    16

    Re: How can I set the best one access point as default

    Thanks Alex, I resolved this issue yesterday.

  9. #9
    Registered User
    Join Date
    Aug 2009
    Posts
    22

    Re: How can I set the best one access point as default

    hi, what if QNetworkSessionpen() does NOT trigger uny popup, neither it open the session??
    tested in nokia 5800

  10. #10
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    228

    Re: How can I set the best one access point as default

    Quote Originally Posted by zzcdyx View Post
    Thanks Alex, I resolved this issue yesterday.
    Hi , i know this is an old thread but i am facing the same problem and didnt get any solution till now from days,

    can you please share how did u solve it? how to prevent the pop up dialog asking for connection?

    Thank you

Similar Threads

  1. How to set the MMS access point programatically?
    By suiying0792 in forum Symbian
    Replies: 0
    Last Post: 2009-10-27, 09:40
  2. Replies: 3
    Last Post: 2009-10-10, 19:34
  3. set proxy settings on access point on nokia s40 3rd edition
    By mike.p in forum Mobile Java General
    Replies: 1
    Last Post: 2008-01-09, 01:18
  4. How to set default access
    By idris_tas in forum Symbian
    Replies: 2
    Last Post: 2007-12-13, 11:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×