Broadcast hub (solved)

Maybe u should try it yourself

I’ve been able to download the companion

Good. I just tried the link with my 4.2.2 cell phone; it loads companion 2.58au with not problems. So, are you OK now?

Yes.Thank u

1 Like

The app does not work if it isn’t open.What is the cause of that?

Generally, App Inventor apps do not run in the background Herin.
When the device screen closes, the apps stop responding.

Specifically what do you mean by does not work?

From the documentation Texting

If the ReceivingEnabled property is set to 1 messages will not be received. If ReceivingEnabled is set to 2 messages will be received only when the application is running. Finally if ReceivingEnabled is set to 3, messages will be received when the application is running and when the application is not running they will be queued and a notification displayed to the user.

Is this the behavior you observe?

What value do you have ReceivingEnabled set to?

If the app is sleeping, nothing will happen unless you set this to 3 and you will only will get any messages after the app awakes again. You will not get a notification.

I’m sorry but there are not any receiving enabled properties to set to ‘1’,‘2’ or ‘3’

This is the tutorial you modified Herin http://www.appinventor.org/BroadcastHub2 .It uses the Texting component. The ReceivingEnabled properties can be set using words using the Designer.

TextingReceivingEnabled

You can also set the values using Blocks. image
If you use Blocks …1 maps to Off; 2 to Foreground, 3 to Always as shown on the Designer. Sorry, how this property is set is confusing but this is MIT’s documentation. What you do depends whether you set the property using the Designer or using Blocks within the code.

Does this help?

Another problem i’m having is that it doesn’t send messages directly, sometimes it doesn’t send at all.
It either needs my permission and that was before I used the send message direct block now it doesn’t even send again

Are you compiling the app with a version of Companion that has a " u " in its version number (for example Companion 2.58au )? To send messages directly you must be using a real device (not an emulator).

I’m using an Android phone not emulator and I compile the app with companion ‘2.58au’

Sorry. I have no additional ideas. You appear to be using the correct tools. Early in the discussion I explained there were known issues with that tutorial that dates from 2014 Herin. Someone else might have suggestions about how to get this working.

Accept what the app can do (you have had some success) or do something different. Perhaps create a chat app on a CloudDB or FirebaseDB . A chat app would provide similar communications functionality for a group of users, but in a very different way.

Regards,
Steve

1 Like

Thank u for u suggestion but I have a lot of faith in the work i’m doing and I can’t back out.you have helped thoroughly and I am greatful

1 Like

This the codes

You did not provide your code Blocks Herin.

I suspect the Runtime Error … Invalid destinationAddress might be a problem with accessing your database of registerd phone numbers.

How are you testing this? Using Companion or a compiled app? Here is what the tutorial says
" The app works great so far, but if you’ve completed some of the earlier tutorials, you’ve probably guessed that there’s a problem: if the administrator closes the app and relaunches it, the broadcast list will be lost and everyone will have to reregister. To fix this, you’ll use the TinyDB component to store and retrieve the BroadcastList to and from a database." You might not be doing that.

Also, this could be an issue with communication to your database. Are you using a TinyWebDB or something else?

What were you doing when the Runtime Error appeared? Loading the app? Sending a Text from the app or something else.

I am using a compiled app and i’m using the **Tiny DB ** component to store and retrieve the broadcast list and it works perfectly but only if the app is running even after setting the receiving enabled properties to 3.
The app wasjust received a member onto my phone when the error showed.
The picture is not uploading for reasons unknown

How to post an image of your Blocks to the Forum:
1- right-click on an empty area of your Block screen. You will see this MENU


2- left-click Downlaod Blocks as Image . Doing this will download an image of all your Blocks to your computer downloads folder.

3 - drag that image from the downloads folder into the Forum Reply text area

I deleted your images you made with a camera… sorry they are unreadable .

Now, try to make a copy of your blocks and post them please.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

You modified the original tutorial a lot. I can’t test your code so for whatever it is worth, here are some comments:

  • The cause of the Runtime Error when “The app was just received a member onto my phone when the error showed.” is probably related to using a text block in the Screen1.Initialize tinydb1.GetVAlue valueIfTagNotThere instead of a required create empty list Block. Do I know for sure? Of course not. I can’t test your app; not having a second phone to test with among the issues. This also could be your failure to check if the valueFromDB is a List.

  • You use a TextToSpeech Block in your addNumberToGroup Procedure; sometimes using that block causes timing issues. As an experiment, I would disable it and see if performance improves.

  • You said "
    I am using a compiled app and i’m using the **Tiny DB ** component to store and retrieve the broadcast list and it works perfectly" - obviously not.

  • I am surprised to see you use a call textingSendMessage instead of a textingSendMessageDirect. The purpose in using a Companion with a u in it is to be able to send texts automatically; isn’t it?

  • " but only if the app is running even after setting the receiving enabled properties to 3." does ‘app is running’ mean when the device is turned off or when it goes to sleep. The tutorial was written for use in a seminar; I guess the intent of the app was to keep the app active so others could use the hub. To use your cell as a hub, you might need to code a StayAwake routine to prevent it from going to sleep. Why a ‘3’ is not working I do not know…it might not be working because of other coding issues identified.

Change some things and you might get this to work the way you want yet.

-Steve

Is there any tutorial to code a stay awake routine??