MCPcopy Create free account
hub / github.com/drosoCode/atvremote / SendIntent

Method SendIntent

pkg/v1/command/command.go:119–140  ·  view source on GitHub ↗

send an intent to the android tv device can be used to start an app with a specific activity ex: com.netflix.ninja/.MainActivity

(intent string)

Source from the content-addressed store, hash-verified

117// can be used to start an app with a specific activity
118// ex: com.netflix.ninja/.MainActivity
119func (c *Command) SendIntent(intent string) error {
120 err := c.sendConfiguration()
121 if err != nil {
122 return err
123 }
124
125 //intent:#Intent;component=
126 iStart := []byte{105, 110, 116, 101, 110, 116, 58, 35, 73, 110, 116, 101, 110, 116, 59, 99, 111, 109, 112, 111, 110, 101, 110, 116, 61}
127 // ex: com.netflix.ninja/.MainActivity
128 intentMsg := append(iStart, text2byte(intent)...)
129 // append ;end
130 intentMsg = append(intentMsg, []byte{59, 101, 110, 100}...)
131
132 message := append([]byte{1, 16, 0, byte(len(intentMsg))}, intentMsg...)
133
134 _, err = c.Connection.Write(message)
135 if err != nil {
136 return err
137 }
138
139 return nil
140}

Callers 1

ExecuteFunction · 0.80

Calls 2

sendConfigurationMethod · 0.95
text2byteFunction · 0.85

Tested by

no test coverage detected