ScreenCast Extension for MIT App Inventor
ScreenCast is an extension designed exclusively for screen mirroring and related settings on Android devices. This extension was inspired by a question in the MIT App Inventor Community and simplifies the process of integrating screen casting features into your apps.
With ScreenCast, you can:
- Open the system's screen mirroring settings.
- Stop active screen mirroring sessions by navigating to the appropriate settings.
- Enable or disable logging for debugging purposes.
Features
- Open Screen Mirroring Settings: Directly navigate to Android's screen casting configuration page.
- Stop Screen Mirroring: Provide access to halt active screen casting sessions.
- Logging: Activate or deactivate logs to debug your application effectively.
Installation Guide
Steps to Add the Extension
- Download the Extension: Obtain the
ScreenCast.aix
file from the Releases section. - Import into MIT App Inventor:
- Go to Extensions > Import Extension > Upload File.
- Select the
ScreenCast.aix
file.
- Add the Component:
- Drag the
ScreenCast
component from the Palette into your workspace.
- Drag the
How to Use
Available Blocks
-
SetLogging
- Enables or disables logging in the app.
- Syntax:
Example:SetLogging(enable: Boolean)
- Pass
true
to enable logs orfalse
to disable them.
- Pass
-
OpenScreenMirroringSettings
- Opens the screen mirroring settings on the Android device.
- Syntax:
OpenScreenMirroringSettings()
-
StopScreenMirroring
- Navigates to the settings page where users can stop screen mirroring.
- Syntax:
StopScreenMirroring()
Example Usage in MIT App Inventor
- Add two buttons:
- Label one as "Start Mirroring" and another as "Stop Mirroring".
- Connect these buttons to the respective blocks:
- Use
OpenScreenMirroringSettings
for the start button. - Use
StopScreenMirroring
for the stop button.
- Use
Here’s an example block setup:
When Button1.Click
call ScreenCast.OpenScreenMirroringSettings
When Button2.Click
call ScreenCast.StopScreenMirroring
Using Native ActivityStarter for Screen Mirroring
If you prefer to use the native ActivityStarter component, follow these steps:
- Add the ActivityStarter Component:
- Drag it from the Palette into your workspace.
- Configure the Properties:
- Set the Action to:
"android.settings.CAST_SETTINGS"
or"android.settings.WIFI_DISPLAY_SETTINGS"
(for older devices).
- Set the Action to:
- Trigger the Action:
- Use a button click to call
ActivityStarter.StartActivity
.
- Use a button click to call
Example Blocks for ActivityStarter
When Button1.Click
set ActivityStarter1.Action to "android.settings.CAST_SETTINGS"
call ActivityStarter1.StartActivity
Permissions Required
The extension automatically handles required permissions, but for reference, these include:
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Screenshots
Files
- AIA: ScreenCast.aia (8.6 KB)
- AIX (Generated with Fast) : com.bosonshiggs.screencast.aix (6.0 KB)
- GitHub: GitHub - iagolirapasssos/ScreenCast: ScreenCast is an extension for MIT App Inventor that provides advanced control for screen mirroring on Android devices.
Community Support
This extension is inspired by a question raised in the MIT App Inventor Community. If you have additional queries or suggestions, please visit the community or open an issue in this repository.
License
This project is licensed under the MIT License.