2016년 12월 6일 화요일

BroadcastReceivers SMS in App Inventor 2


I have been trying to make my app work for a long time now - but for whatever reason, the SMS Broadcast Receiver does not seem to work. I want an alert to play every time an SMS is received, but that isn't happening. 

I am attaching my AI source code. I would really appreciate any help in this regard.


☞ ISEF.aia

-- 
without looking at your project:
your app must be up and running to be able to play an alert
and in case you are using the Google Voice feature, this works only in the United States, but not elsewhere

I can offer this workaround
-- 
In the trigger text field, does the text need to be a part of the SMS - like "x y puravida z" or must the text be exclusively "puravida"? 

-- 

Clear line on canvas without clear canvas


A very simple question: I draw a colored line on a black canvas, how can to clear the line without clear all canvas (If I draw a black line, the background of canvas does not go back black), thanks.

--
You could try setting your PaintColor to 16777215 which is the 'none' color value.
then redraw the line in that color.
The problem with that is if you have one line crossing over another line, it will leave a hole in the other line.
Not good.
So I recommend that you store the DrawLine x1,y1,x2,y2 values in a list as you  draw the lines.
Then when you need to undo the last line drawn, clear the screen and redraw all lines in the list except the last one.
You can even simulate a redo as well.

--
Nothing change with "none color", with I redraw remains a not color black !

-- 
I think that does not work as it is just drawing a transparent line over an opaque line so has no effect.
I have tried another method that sets the color of the line to the canvas backgroundcolor to erase the line.
It will work if you have set the canvas backgroundcolor to anything but 'none'.

First the line is drawn at the specified color then it is erased by using linewidth + 1 for the size of the line.
If the original linewidth is used, a border is left for some reason.


-- 
Thank you very much.

--

No Desktop icon, No emulator


I downloaded and updated the emulator yesterday and it worked. Today the emulator will not open, it says I need to open AI Starter, even though it is open.  I've closed and reopened everything, it will not work.  I then tried to open it on my phone with AI Companion, the phone also will not open the app.???  Windows 8.1 - 64 bit - intel i3. ??? Chrome updated ???

-- 

Designing an app using INKSCAPE (Video tutorial)


I have finished a tutorial (divided in 3 parts) about designing an app inventor app using Inkscape. I explained a little bit about the process.
This is a good approach when you want to have an original an not very common design or layout, and the best thing it is that you will learn how to make your apps look the same in different screens or devices. I hope you fin the tutorials understandable and useful. Thanks friends!
Links:





☞ INKSCAPE
--
You have been making some of the best App Inventorvideo tutorials I have seen.
In this tutorial, I really like the use of transparent buttons over a nicely designed background and the way you use percentages from the layout in Inkscape.
Thank you!

--  
very nice! great tutorial!

-- 
Very nice explanation.  I'll be using this for sure.  I was wondering how to center items etc.

-- 

Multi choice using images as answers


I am trying to build a language learning app and have made a list of questions. The app is multi-choice but the answers are four buttons which only have pictures as the answers. I want to assign the images I have uploaded to the buttons and to be either correct or incorrect based on the list of questions. 
 screen.jpg
 blocks.jpg
--
You can have a list of lists where each row in the list contains the names of the four pictures to display:

--
((kiwi.png maunga.png Manu.png Kiore.png) (bat.png rat.png bird.png mouse.png) ...)

You can also have another list that contains the index of the picture that is the correct answer:
(4 1 3 ...)

when the user touches one of the buttons, determine if it was button 1, 2, 3 or 4 then lookup the correct answer index and compare the button index to the answer index.
What about a variation of your idea where the question is 'Which picture depicts a 'kaipuke' and the pictures have no text.
The user will have to know that a kaipuke means boat or ship and to touch the boat rather than one of the other random pictures.
Just a thought.

you also could adjust my quiz example to your needs

-- 

A Multiple Choice Quiz: How to work with the advanced features

☞ quiz.aia

-- 



How to access a specific item of a list


I used this website(http://appinventor.pevest.com/?p=490) for my app that is simply supposed to get a file(a list of latitude longitude coordinates) from an arduino mega then take. But it does not show how to access each column. I am looking to read a file then plot the longitude and latitude separately.

I hope I am clear in what I am trying to do. But in case its not then I have a simple example showing what I want to do. 

File example:
32.3459,88.0439
32.3458,88.0438
.
.
.

App reads file and parses it. Something like it
longtextbox: 32.3459
lattextbox: 88.0439

then it reads the next line
longtextbox: 32.3458
lattextbox: 88.0438

...and so one

-- 
you might want to ask the author of that example there http://appinventor.pevest.com/?p=490

-- 
Read the file into a list from csv table block.
Then get a row of lat,lon with select list item.
From that row do another select list item where the index is 1 for lat value, and 2 for lon value.

-- 

Using TinyDB


Since my thread is getting pushed back, nobody has responded to it so I thought I might post it again. My thread was: https://groups.google.com/forum/#!category-topic/mitappinventortest/specific-programming-issue/upMDewqjpQA
My latest questions was:

What do I put in the 'valueIfTagNotThere'. I want it to display 'off' if it can not find a tag. 

See below image and previous thread for reference. 
 Blocks.png-- 
I would say, use the off.Text block which would store whatever the value you set in the Designer for that TextBox: ON, OFF or empty text if this is the first time the app has be run.

-- 
It's okay, by storing the colour background solved it. Thanks

-- 

Cannot find the if-then-else block


as title.

-- 
See this discussion.


★ if-then and if-then-else block 

May I know why the block-shape of "if-then" and "if-then-else" are different?
That really annoyed me, when I want to write a simple if-statement.

Is it possible to change the shape of the block?

--
???
are you asking, how to use the mutator block?


--
nope.  I found I missed the blue bottom
Problem solved,  Thanks

--
that blue button is the mutator

--


How do I keep same index # for randomized quiz and answers?


Hi everyone. My quiz questions are being selected at random from a list and they are not being repeated. I used tutorials or previous questions on the forum to get that far. However I am having some trouble figuring out how to keep the answers to the quiz matched correctly to the quiz questions.

I attached two pictures. One of them works perfectly but does not randomize questions. The second randomizes and doesn't repeat the questions but the answer is ALWAYS wrong. Except for the first iteration.list
Screen Shot 2016-04-04 at 6.09.09 AM.png 표시 중
Screen Shot 2016-04-04 at 6.05.53 AM.png 표시 중


You should have a list of questions and a list of indexes to correct answers initially in the same order.
When you randomize the questions index, you use the same index to access the index of the correct answer in the answers list.

-- 
It looks like you should be using global Index rather than local QuestionIndex to index your lists or change your if block to use the local QuestionIndex also.

-- 
Also, since you never remove answers from AnswerList, your indexes get out of sync between your shrinking QuestionList and unshrinking AnswerList.

But if you remove the Answer from the AnswerList at the same time you remove the Question from QuestionList, how will you check it when the Submit button is clicked?
You have to save the current Answer in a separate global variable before removing it, and check the Answer global against the user input when Submit is clicked.

-- 

How ro capture phone number


I am developing an app that i would like it to capture the dialed number from any android phone, Now i ca see that I can develop an app which can help me make calls and capture the number, but i will prefer when I dial from the phone default interface the app should automatically capture the number. Please help.

-- 
there are no blocks available to do this in MIT AppInventor
probably you could write your own extension and create a block yourself...

more information about how to create an extension see here https://groups.google.com/d/msg/mitappinventortest/Ip2AX036d0U/5NJlAEbFCgAJ
however that will be more advanced and will require some Java skills...


★★★★★
The MIT App Inventor team is delighted to announce the availability of Extension Components for testing. We hope the Extension Components  will prove to be a major enhancement to App Inventor:   Extensions provide a way for anyone to build their own App Inventor components, which others can then use in creating apps.   

App Inventor is free and open software, so people have always been able to build personal systems and install their own components.   But until now, the only way to make those components available to others has been to create and maintain a personal App Inventor server  that has those components built in.

Extension components, in contrast, can be loaded dynamically into any App Inventor system, so they can be shared and imported into projects as needed.   For example, educators and educational software developers to provide extension components tailored to specific lessons and activities, so that students can have these available in building apps.  Examples might be simulations or tools for large-scale data analysis, or image recognition.  Those features might be unfeasible to implement with the built-in App Inventor blocks, either because of processing speed or programming complexity.   But the same capability might be readily implemented using extension components that encapsulate the necessary processing.

Anyone can create extension components. This requires gaining some familiarity with the App Inventor source code (located on Github) and programming in Java.   Once you create an extension component, you can share it with anyone for use in their App Inventor projects.   Extension components can be housed anywhere on the Web.   They need not be stored at MIT or any other special place, although MIT hosts a repository where people can make extension components available for sharing and public use.

Today, we’re releasing a test server for App Inventor that supports the Extension Components feature.   You can find it at extension-test.appinventor.mit.edu.  There’s also a document called App Inventor Extensions that explains how to create and use Extension Components.   Once we've accumulated enough feedback, we'll make extension components a regular part of App Inventor.

With extensions, the range of App Inventor features can be expanded enormously.   We hope that people will explore this tool to build new capabilities for App Inventor and their creations.

The implementation of App Inventor Extension Components is the work students who participated with the MIT App Inventor team in through Google Summer of Code: Ethan Hon, Justus Raju, and Mouhamadou Sall.   Other summer GSoC App Inventor participants in 2015 are Devid Farinelli, Yucun Li, and  Shruti Rijhwani.  All of them are extraordinarily talented, and the entire App Inventor community is in their debt. 
                           ★★★

Best data storage location?


I am creating a simple app that will connect users who want to buy and sell 2nd-hand university text books. I will require 2 tables, both with +-1000 rows. One is user data (username and pass) and another is a list of books at my university that can be selected to buy or sell by the user. I am unsure where to store the data. Am I correct when I say the only options are TinywebDB or Fusion Tables and that I can't use something like Google's Cloud Storage with Buckets as it is unusable by the AppInventor?

 I already have my custom TinywebDB but I need another one for the second table, the books. Will TinywebDB be sufficient for my purposes and how can I create the second table? Should I rather use Fusion Tables or is Fusion Tables more used for data visualization?

I also can't do service authentication on Google's dev site for fusion tables because instructions on http://ai2.appinventor.mit.edu/reference/components/storage.html#FusionTablesControl I think displays old version of the site. Help with this would also be appreciated.

-- 
you can use any data storage
using fusiontables probably would be the easiest method


-- 
We'll check the documentation, but Fusion Tables service accounts work, as describe in the document Taifun referenced.

-- 
Am new to this and tried to download the offline version for mine windows PC.But i can not download form the site thus http://appinv.us/aisetup_windows . Can anyone please help me with the executable file. My email address is eani286@gmail.com. Thank and hope to hear from you guys soon.

-- 
I believe that offline versions are not stable and after a while, its database may go corrupted. You should use it with caution.

-- 
@Hossein: ???

@enmauuel: first of all, if you have a new question, then please start a new thread instead of hijacking another thread. thank you!

it seems to be, you are trying  to download the AppInventor installer from here http://appinventor.mit.edu/explore/ai2/windows.html
I just tried it and the download seems to work fine for me
you only have to download the installer in case you like to use the emulator

the recommended option is to use an Android device and a WiFi conneciiton see also here 

-- 

Google Places API


Can anyone recommend resources or tutorials for using Google Places API?  

-- 
Haha, slightly passive aggressive response.

Yep I've had a good google and read some of the generic stuff around google places.  I was wondering if there was anything specific to app inventor as I can't find much.

-- 
this https://groups.google.com/forum/#!searchin/mitappinventortest/Google$20Places$20API is what this forum knows about the Google Places API

-- 

WebDB to TinyDB


When I backup my TinyDB is OK
The Code is



I Want To restore it

How can I do that

--
You should also store the taglist of your TinyDB in your TinyWebDB and upon restoring you go through each element in the same way as you backed it up, but now in the other direction. You need to store the taglist because the TinyWebDB does not have a gettags block, and besides, you may want to store also other things in it.

--
Do you mean like this




-- 
You have to add something like what I indicated in the picture.
You must save a list of the tags you saved to the TinyWebDB.
b.t.w. It would be more clear if you change Downloaded to Uploaded. Upload is from phone to web, download from web to phone, for most people.

Then, when you restore the backup (Restore would be a better name than Save I think), you download the list in the tag "localTagList" first and then, in the same way as you now go from TinyDB to TinyWebDB, you retrieve for each element in your "localTagList"the value in the TinyWebDB and store it in the TinyDB.

-- 



Help BluetoothClent


using BluetoothClent.ReceiveText control in a timer block to receive data, 


can I use simultaneously in Button.Click, BluetoothClent.SendText to send data?

-- 
Hi, sorry,
but I can use BluetoothClent for both receiving and sending text?

--