Andy A
Andy A

Reputation: 137

Intent not available from within app

I have the intent com.amazon.tv.settings/.hud.HudActivity which I can launch through adb using adb shell am start -n "com.amazon.tv.settings/.hud.HudActivity" on the Amazon Fire TV v3. However when I launch the same intent through code:

getApplicationContext().startActivity(new Intent("com.amazon.tv.settings/.hud.HudActivity"));

It is unable to find the activity producing the error:

E/AndroidRuntime: FATAL EXCEPTION: Timer-0
                  Process: com.baronkiko.launcherhijack, PID: 23262
                  android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.amazon.tv.settings/.hud.HudActivity }
                      at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1809)
                      at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523)
                      at android.app.ContextImpl.startActivity(ContextImpl.java:820)
                      at android.app.ContextImpl.startActivity(ContextImpl.java:797)
                      at android.content.ContextWrapper.startActivity(ContextWrapper.java:356)
                      at com.baronkiko.launcherhijack.AccServ$1.run(AccServ.java:111)
                      at java.util.TimerThread.mainLoop(Timer.java:555)
                      at java.util.TimerThread.run(Timer.java:505)

This is a system intent that I really need. How can I launch this intent, do I need some more permissions? I appreciate any help I may receive.

Upvotes: 0

Views: 202

Answers (2)

Access Denied
Access Denied

Reputation: 9491

You can use the following code to create appropriate Intent:

getApplicationContext().getPackageManager().getLaunchIntentForPackage("com.amazon.tv.settings/.hud.HudActivity");

Upvotes: 1

wgm
wgm

Reputation: 2188

Please try this:

    Intent intent=new Intent();
    intent.setComponent(new ComponentName("com.amazon.tv.settings", "com.amazon.tv.settings.hud.HudActivity"));
    getApplicationContext().startActivity(intent);

When you call

new Intent("com.amazon.tv.settings/.hud.HudActivity")

"com.amazon.tv.settings/.hud.HudActivity" is regarded as action not class name.

Upvotes: 1

Related Questions