[SOLVED]QT 5.3 for Android in GPS mode don't work !!!



  • Hi for all...

    I have sucess in create JNI gps positioning, but want change to C++ positioning, testing new QT5.3
    and modify for access and read simplelog.txt file in android, and add AndroidManifest to access sdcard and
    positioning permissions to fine locations , but not return any coordinates !!!!

    iam testing all positioning examples for 5.3.
    in Development 5.3 is full for android GPS !!!

    testing in Sansung note 3 octa , genesis tab 7326 dual, friendlyarm quad tiny 4412, and never sucess.

    all devices is rooted....
    and android > android 4.0
    any idea...

    thanks.



  • Hi
    I have tried to test Weetherinfo sample and immediatly one didn't work rightly (I did not get information too). I have not time to investigate code of this sample moreover I am not strong enough in QML. But I exactly know positioning works correctly. I have my application written on pure C++. You may write your own application.
    For this do next

    • in .pro file add
      @QT += positioning@

    • add slot
      @void positionUpdated(const QGeoPositionInfo &info);@
      in your class and

    @ #include <QGeoPositionInfoSource> @

    in header where this class places.
    
    • in constuctor add

    @....
    QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(0);

    if (source) {
    

    //here set up your update interval in msecs
    source->setUpdateInterval(1000);// 1 second
    connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
    this, SLOT(positionUpdated(QGeoPositionInfo)));
    source->startUpdates();
    }
    .....
    @

    • write your slot for example
      @
      void ControlDialog::positionUpdated(const QGeoPositionInfo &info)
      {QGeoCoordinate coord=info.coordinate();
      double lat,lng;
      lat = coord.latitude();
      lng = coord.longitude();
      if(info.isValid()){
      ////.......
      }
      else{
      /////.....
      }
      qDebug() << "Position updated:" << info;
      }
      @

    If you want to get satellite information similarly do next

    • add slots

    @
    void satellitesInViewUpdated( const QList<QGeoSatelliteInfo>& satellites );
    void satellitesInUseUpdated( const QList<QGeoSatelliteInfo>& satellites );@

    add header

    @#include <QGeoSatelliteInfoSource>@

    • add in constructor

    @....
    QGeoSatelliteInfoSource* satelliteInfoSource = QGeoSatelliteInfoSource::createDefaultSource( 0 );
    if ( satelliteInfoSource ) {
    satelliteInfoSource->setUpdateInterval(2000);
    // Whenever the satellite info source signals that the number of
    // satellites in use is updated, the satellitesInUseUpdated function
    // is called
    connect( satelliteInfoSource,SIGNAL( satellitesInUseUpdated(const QList<QGeoSatelliteInfo>& ) ),
    this,SLOT( satellitesInUseUpdated(const QList<QGeoSatelliteInfo>& ) ) );

         // Whenever the satellite info source signals that the number of
         // satellites in view is updated, the satellitesInViewUpdated function
         // is called
         connect( satelliteInfoSource, SIGNAL( satellitesInViewUpdated(const QList<QGeoSatelliteInfo>& ) ),
                                          this, SLOT( satellitesInViewUpdated(const QList<QGeoSatelliteInfo>& ) ) );
    
         // Start listening for satellite updates
          satelliteInfoSource->startUpdates(); 
    }
    

    @

    • write your satellite information slots
      @
      void ControlDialog::satellitesInViewUpdated(const QList<QGeoSatelliteInfo>& satellites )
      {
      // The number of satellites in view is updated
      ui->lbl_SatInView->setText(QString::number(satellites.size()));
      // mLastGPSInformation.satellitesInView.clear();
      // for ( int i = 0; i < satellites.size(); ++i ){
      // QGeoSatelliteInfo currentSatellite = satellites.at( i );
      // QgsSatelliteInfo satelliteInfo;
      // satelliteInfo.azimuth = currentSatellite.attribute( QGeoSatelliteInfo::Azimuth );
      // satelliteInfo.elevation = currentSatellite.attribute( QGeoSatelliteInfo::Elevation );
      // satelliteInfo.id = currentSatellite.prnNumber();
      // satelliteInfo.signal = currentSatellite.signalStrength();
      // mLastGPSInformation.satellitesInView.append( satelliteInfo );
      // }
      // mLastGPSInformation.satInfoComplete = true; //to be used to determine when to graph signal and satellite position
      // emit stateChanged( mLastGPSInformation );
      }

    void ControlDialog::satellitesInUseUpdated(const QList<QGeoSatelliteInfo>& satellites )
    {
    // The number of satellites in use is updated
    ui->lbl_SatInUse->setText(QString::number(satellites.count()));
    // mLastGPSInformation.satellitesUsed = QString::number( satellites.count() ).toInt();

    // mLastGPSInformation.satPrn.clear();
    // for ( int i = 0; i < satellites.size(); ++i ){
    // QGeoSatelliteInfo currentSatellite = satellites.at( i );
    // //add pnr to mLastGPSInformation.satPrn
    // mLastGPSInformation.satPrn.append( currentSatellite.prnNumber() );

    // //set QgsSatelliteInfo.inuse to true for the satellites in use
    // for ( int i = 0; i < mLastGPSInformation.satellitesInView.size(); ++i ){

    // QgsSatelliteInfo satInView = mLastGPSInformation.satellitesInView.at( i );
    // if ( satInView.id == currentSatellite.prnNumber() ){
    // satInView.inUse = true;
    // break;
    // }
    // }
    // }
    // mLastGPSInformation.satInfoComplete = true; //to be used to determine when to graph signal and satellite position
    // emit stateChanged( mLastGPSInformation );

    }
    @

    If you want to use and QGeoPositionInfoSource and QGeoSatelliteInfoSource simultaneously do update Qt to 5.3.1



  • ok

    thanks...



  • Yes
    vladmir70

    works for me

    thankyou very much !!!!!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.