No Activity found to handle Intent regarding android TV input change

Viewed 30

Can anybody help me with this?

I am gonna build an apk for android TV in which by running that app, the tv input would change to a specific hdmi input. Using the adb command, it is way easy. I just used the following adb command and it works like a charm!

adb shell am start -a android.intent.action.VIEW -dcontent://android.media.tv/passthrough/com.realtek.tv.passthrough%2F.hdmiinput.HDMITvInputService%2FHDMI300004

But when I am gonna convert the adb command to an app using following script, I got "No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://android.media.tv/passthrough/com.realtek.tv.passthrough/.hdmiinput.HDMITvInputService/HDMI300004 }"

The script is as follows:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("content://android.media.tv/passthrough/com.realtek.tv.passthrough/.hdmiinput.HDMITvInputService/HDMI300004")));

Update: I found the solution. The script should be as follows:

      Uri inputInfoIdUri=TvContract.buildChannelUriForPassthroughInput("com.realtek.tv.passthrough/.hdmiinput.HDMITvInputService/HDMI300004");
      Intent intent = new Intent(Intent.ACTION_VIEW);
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      intent.setData(inputInfoIdUri);
      startActivity(intent);
0 Answers
Related