0

I try to open my app with a QR Code generated : myApp://open
When I scan it, it send me an error message : "Sorry the application requested could not be launched. The content of the barcode may be invalid".

<activity
            android:name="com.myCompany.LoginActivity"
            android:configChanges="orientation"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <data android:scheme="myApp" android:host="open"/>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE"/>
            </intent-filter>
            <intent-filter>
                <data android:scheme="myApp"/>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE"/>
            </intent-filter>
        </activity>

I try this ticket with no success.

Thanks

ΩlostA
  • 2,501
  • 5
  • 27
  • 63

2 Answers2

2

Your activity needs to be exported in order for other applications to launch it.

<activity
        ...
        android:exported="true">
Dan Harms
  • 4,725
  • 2
  • 18
  • 28
1

There is no problem with your code. However, you may be having problems due to the new "exported" logic.

If this element is set to "false" and an app tries to start the activity, the system throws an ActivityNotFoundException.

more information

Or, there may be a problem with the QR code you simply made. Try to create from this address.

Ramazan Akbal
  • 34
  • 1
  • 4
  • I trie to put the code but nothing happens ** – ΩlostA Apr 25 '22 at 11:50
  • My problem come from the fact that the phone uses Google Lens, but it doesn't work offline, how to do it correctly – ΩlostA Apr 25 '22 at 14:50
  • When you say "nothing happens" do you mean that it doesn't actually throw an error? Are you sure the QR code is correct? Have you tried by downloading the intent tester app to the device you are using? – Ramazan Akbal Apr 25 '22 at 22:38
  • A second solution may be to use https. Most browsers do not support non-https, the best thing you can do is redirect with js through a site. – Ramazan Akbal Apr 27 '22 at 11:05