2

I cannot open activity from the terminal via the command below,

adb shell am start -n com.mypackage/com.mypackage.MyActivity -d --es myvariable1 myvalue1 --es myvariable2 myvalue2 -d

On Android 13 it returns:

Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] dat= pkg=username cmp=com.mypackage/.MyActivity } Error type 3 Error: Activity class {com.mypackage/com.mypackage.MyActivity} does not exist.

It works on Android 12 and lower.

Couldn't find any information about that except https://developer.android.com/about/versions/13/behavior-changes-all#intents

When I match the Intent filter as mentioned in the link

adb shell am start -a android.intent.action.VIEW -d myscheme://myhost/myprefix -n com.mypackage/com.mypackage.MyActivity

opens but I need to open activty with my parameters without myscheme://myhost/myprefix and View intent

Do you have any idea?

Perihan Mirkelam
  • 526
  • 1
  • 5
  • 18

1 Answers1

1

You probably need to add a separate intent filter to launch: https://automationchronicles.com/error-when-opening-chrome-on-android-13-via-adb/

e.g.

<activity
        android:name=".mypackage.MyActivity"
        android:exported="true"
        android:windowSoftInputMode="adjustResize">
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
      </intent-filter>

      <intent-filter>
        <action android:name="android.intent.action.VIEW" />

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="myhost"
            android:scheme="myscheme" />

      </intent-filter>
lecker909
  • 181
  • 3
  • 6