working fine in MITAI2 Companion but not working if build apk

29 views
Skip to first unread message

Prem Naik

unread,
Apr 16, 2019, 1:28:51 AM4/16/19
to MIT App Inventor Forum
i have copied all block from there respective programmer and tested in my MI MAX 2 device but it works well only in appcompanion and 
not working after build .apk using both QR or download to pc option.

can any one help me.
thanks
BluetoothWatch (1).aia

Chris Ward

unread,
Apr 16, 2019, 7:06:55 AM4/16/19
to MIT App Inventor Forum
Hello Prem

What device is your Xiaomi sending the commands to?

Can you expand your description? "Not working" could be anything - what does not work?

So far as I can see, your App:
  1. Sends a command to a Bluetooth device
  2. Records the Phone Number when the User makes a call with the Xiaomi
  3. Receives text messages (from where?) and replies to them with the contents of Label1 (which is not assigned with any text by your blocks?)
It is not at all clear as to what the purpose of your App is :)  What exactly is the Bluetooth Device that receives the App commands? 

Prem Naik

unread,
Apr 16, 2019, 8:47:56 AM4/16/19
to MIT App Inventor Forum
i am using the app for send caller number to display attached to arduino by Bluetooth serial .
when i Test the app in MITAI2 app companion it send the caller no to arduino but using standalone after buid apk it does not send the caller no.

my question is why not sending command when using downloaded apk?



blocks.png

Chris Ward

unread,
Apr 16, 2019, 9:15:01 AM4/16/19
to MIT App Inventor Forum
Hi again

Well, surprised it was working fine with the companion because I would usually ask people to use an APK (Companion just gets in the way!).

I have tweaked your code, see attached: BluetoothWatch_1.aia  Note, Chrome flags .aia files as dangerous - you have to "accept anyway" to receive it :(

The string sent to Arduino should not end " \n" (space newline) because the Bluetooth function is going to append it with an end-of-data mark ( = \n). I have added this to your screen initialization.

I have also added an extra Label to QA the send - that allows you to see that the string you are sending is as expected.

If the tweaked Project does not work and you still can't see why, please post your Arduino Sketch here.


BluetoothWatch_1.aia
Reply all
Reply to author
Forward
0 new messages