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. Android need Broadcast Receiver for Zebra Scanner
Qt 6.11 is out! See what's new in the release blog

Android need Broadcast Receiver for Zebra Scanner

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 259 Views 2 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.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by Andy314
    #1

    Hello,

    the Zebra scanner can send its data via intent.
    I use Qt 6.7.3 Clang Arm

    Manifest:

    <receiver
        android:name="org.qtproject.example.CarDamage.ScanReceiver"
        android:exported="true"
        android:enabled="true">
         tools:remove="android:permission">-->
        <intent-filter>
            <action android:name="org.qtproject.example.CarDamage.SCAN"/>
        </intent-filter>
    

    Java Receiver in
    ..ProjectFolder\android\src\org\qtproject\example\CarDamage

    package org.qtproject.example.CarDamage;
    
    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.util.Log;
    import android.widget.Toast;
    import java.lang.RuntimeException;
    
    public class ScanReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
                    Log.e("ScanReceiver", "### RECEIVER HIT ###");
                   Log.w("ScanReceiver", "### WARNING TEST ###");
                   Log.i("ScanReceiver", "### INFO TEST ###");
                   // Toast.makeText(
                   //            context,
                   //            "ScanReceiver HIT",
                   //            Toast.LENGTH_LONG
                   //        ).show();
        }
    }
    

    Testing:

    adb shell am broadcast -a org.qtproject.example.CarDamage.SCAN
    
    

    and

    adb logcat -s ScanReceiver
    

    I get no log entries. OnReceive will be never called.

    Any ideas how to solve the problem.

    1 Reply Last reply
    1

    • Login

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