Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Run Intent for Qt Android app

Run Intent for Qt Android app

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vitaliy
    wrote on last edited by
    #1

    Hello. I design android application for use rtl dongle. Because i cannot find a solution to read the usb device with libusb in Android i found a JAVA app from martin martinov, at this link https://play.google.com/store/apps/details?id=marto.rtl_tcp_andro&hl=en

    Use this driver with java:

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setClassName("marto.rtl_tcp_andro", "com.sdrtouch.rtlsdr.DeviceOpenActivity");
    intent.setData(Uri.parse("iqsrc://-a 127.0.0.1 -p 1234 -n 1"));
    startActivityForResult(intent, RTL2832U_RESULT_CODE);
    

    So, i write this in Qt C++:

    QAndroidJniObject url = QAndroidJniObject::fromString("iqsrc://-a 127.0.0.1 -p 1234 -n 1 -f 100000000 -s 1024000");
    if(url.isValid())
    {
        QAndroidJniObject intent=QAndroidJniObject::callStaticObjectMethod("marto/rtl_tcp_andro/DeviceOpenActivity","parseUri","(Ljava/lang/String;I)Lmarto/rtl_tcp_andro/DeviceOpenActivity;", url.object<jstring>(),0x00000001);
    
        if(intent.isValid())
        {
            QtAndroid::startActivity(intent, RTL2832U_RESULT_CODE, this);
            qDebug() << ("QtAndroid::startActivity receiverRequestCode: " + QString::number(RTL2832U_RESULT_CODE));
        }
        else
        {
            qDebug() << "invalid QAndroidJniObject intent";
        }
    }
    else
    {
           qDebug() << "invalid QAndroidJniObject url";
    }
    

    And, this not work - object intent is not valid. In my console - "invalid QAndroidJniObject intent";
    Who can help me?

    A 1 Reply Last reply
    0
    • V Vitaliy

      Hello. I design android application for use rtl dongle. Because i cannot find a solution to read the usb device with libusb in Android i found a JAVA app from martin martinov, at this link https://play.google.com/store/apps/details?id=marto.rtl_tcp_andro&hl=en

      Use this driver with java:

      Intent intent = new Intent(Intent.ACTION_VIEW);
      intent.setClassName("marto.rtl_tcp_andro", "com.sdrtouch.rtlsdr.DeviceOpenActivity");
      intent.setData(Uri.parse("iqsrc://-a 127.0.0.1 -p 1234 -n 1"));
      startActivityForResult(intent, RTL2832U_RESULT_CODE);
      

      So, i write this in Qt C++:

      QAndroidJniObject url = QAndroidJniObject::fromString("iqsrc://-a 127.0.0.1 -p 1234 -n 1 -f 100000000 -s 1024000");
      if(url.isValid())
      {
          QAndroidJniObject intent=QAndroidJniObject::callStaticObjectMethod("marto/rtl_tcp_andro/DeviceOpenActivity","parseUri","(Ljava/lang/String;I)Lmarto/rtl_tcp_andro/DeviceOpenActivity;", url.object<jstring>(),0x00000001);
      
          if(intent.isValid())
          {
              QtAndroid::startActivity(intent, RTL2832U_RESULT_CODE, this);
              qDebug() << ("QtAndroid::startActivity receiverRequestCode: " + QString::number(RTL2832U_RESULT_CODE));
          }
          else
          {
              qDebug() << "invalid QAndroidJniObject intent";
          }
      }
      else
      {
             qDebug() << "invalid QAndroidJniObject url";
      }
      

      And, this not work - object intent is not valid. In my console - "invalid QAndroidJniObject intent";
      Who can help me?

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @Vitaliy Are you sure you have the class and function signature correct?

      Maybe run in a debugger and step into the QAndroidJniObject creation and see why it might be failing.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved