Can a MIT App Inventor App send a broadcast?

Hello,

Can a MIT App Inventor App send a broadcast?

I'm looking to start an Automate Flow from a MIT App Inventor App, I asked the question on the Automate SubReddit and got this response,

Probably, if it can send broadcasts or start services.

  • Action: com.llamalab.automate.intent.action.START_FLOW
  • Data URI: content://com.llamalab.automate.provider/flows/
  • Package: com.llamalab.automate

I know a MIT App Inventor App can't start a service, I suspect it will be the same for a broadcast, but would like conformation.

Thanks

Documentation ⋅ Automate ⋅ LlamaLab is very powerful.

The Activity Starter is a likely candidate for talking to llamalab automate,
both as caller and callee.

AI2 has no inherent broadcast facilities.

Yea,

Unfortunately I tried ActivityStarter got a 601.

unfortunately you forgot to add a screenshot of your relevant blocks...
see also Using the Activity Starter chapter " Discovering how to set the ActivityStarter properties"

Taifun

1 Like

Hello,

I've created an App that takes button presses from Arduino and then acts on them.

One of the button presses opens another app (in this case google assistant preceded by some text to speech).

When the MIT App Inventor App is in the foreground its works fine, the text to speech fires and then the Google Assistant toast pops up.....

When the MIT App Inventor App is in the background after pressing the Arduino button the text to speech fires but the Google Assistant only fires when the MIT App Inventor App is brought to the foreground.

On Android 8 the Google Assistant fires & the toast pops up no matter if the app is in the background or foreground, but on Android 12 Google Assistant toast only pops up when the MIT App Inventor App is in the foreground (I've only got Android 8 &12 devices to hand).

So I have 3 questions,

  1. There is a change in behaviour for Android 12 Foreground service launch restrictions-Android12 | by Nav Singh 🇨🇦 | Medium does anyone know a way round this for a MIT App Inventor App?

  2. Is there away to force the Google Assistant to open whilst My App is in the background, (I think this is possible as using the App "Automate" I can create a Flow that opens the Google Assistant in the foreground no matter if there are other apps open in the foreground.

  3. How can I bring the MIT App Inventor App to the foreground as a work around before the Google Assistant fires
    IE
    After Arduino button pressed,

Fire text to speech blocks, fire bring MIT App Inventor App to front blocks, fire start Google Assistant blocks.

Any ideas\help would be most appreciated, as it's doing my nut in :confused: :confused: :confused:

Thanks

Isn't this all related to your other two topics. Why open another one instead of continuing with your other topics?

Yep,

It is I just thought I would rephrase it.

I can't believe that it's this difficult, just to open another app.

I joined them.

If you want to open another app use the activitystarter.

Using the Activity Starter Component like @Taifun said.

Solved, You have to add these 2 lines to the manifest,

<uses-permission android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

Hi, I found a solution.
I used to get 601 error too, until I filled correctly the Activity Class - can not be empty.
(I used Automate App -> New flow -> App start block, where I browsed available Packages and Activity Classes).

My dial for MIT App ActivityStarter is:

  • ActivityPackage: com.llamalab.automate
  • ActivityClass: com.llamalab.automate.StartServiceActivity
  • Action: com.llamalab.automate.intent.action.START_FLOW
  • Data URI: content://com.llamalab.automate.provider/flows/Your-flow-id/

You find "Your-flow-id", if You open in Your Automate flow, open the Flow beginning block - it at the bottom in Current values section. For me, it works both with and without the "/statements/1" part.

Tested with Automate 1.33.4 (14Jun2022) on Samsung Galaxy S7, on Android 8.0.0


MIT App Inv Activity starter + Automate is great combination for recording high-resolution videos from MIT App Inventor in the background using simple Automate flow. Simply no DefaultFileScope problems :slight_smile:

Try it with Android V12, the security has changed significantly from V8 to V12.