Remote Control Intent¶
Using the Remote Control feature of the MDM requires users of the devices to start sessions locally, in order to mark devices as ready to cast.
However, you may want this feature to be accessible through your business application in order to avoid having to teach your users to navigate the Famoco Layer's menus, which might be unfamiliar to them.
Thanks to the Sample Code found below, you will be able to generate buttons in your application which start or stop the remote control sessions on the device.
Sample Code¶
Access to this feature requires the following intent filters to be declared in the application's Android Manifest:
<activity
(...)
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Find below an example of Kotlin functions which you could incorporate into your business application:
import android.content.Context
import android.content.Intent
private fun start(context: Context) {
val liveSupportIntent = Intent().apply {
`package` = "com.famoco.live_support"
action = "com.famoco.action.START_REMOTE_CONTROL"
}.setFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
context.sendBroadcast(liveSupportIntent)
}
private fun stop(context: Context) {
val liveSupportIntent = Intent().apply {
`package` = "com.famoco.live_support"
action = "com.famoco.action.STOP_REMOTE_CONTROL"
}.setFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
context.sendBroadcast(liveSupportIntent)
}
Thanks to these functions, you may now start and stop the Remote Control session through buttons in your own application:
Button(
onClick = { start(context) },
// Other properties
)
Button(
onClick = { stop(context) },
// Other properties
)