Adding to or appending more code, understanding Blocks better

62 views
Skip to first unread message

pat saturn

unread,
Jan 30, 2015, 8:10:06 PM1/30/15
to mitappinv...@googlegroups.com
I wanted to add an email to the app where is my car.

I have sucessfully made where is my car work, I have edited it to fit my project.
now I want to add the code below...


Start the mailer with pre-addressed message

To start the Android mailer application, use the action android.intent.action.VIEW . You can use Activity starter's DataUri property to specify the recipient, the subject, and the body of the message. In each case, starting the activity will bring up the Android mailer, and you can complete the message and then press "Send".

For example, if you specify:

Action: android.intent.action.VIEW
DataUri: mailto:sa...@northpole.com < not this>

then starting the activity will bring up the mailer, with the addressee filed in.

If you specify:

Action: android.intent.action.VIEW
DataUri: mailto:sa...@northpole.com?subject=Please Santa&body=Bring me a pony< this one>

<< this is the example of course>>

then starting the activity will bring up the mailer, with the addressee, the subject, and the body filled in. You can use the mailer to edit these before sending the message, if you prefer.

The DataURI here must be a URL encoded message designed to work with the internet mailto service. Search the Web to find appropriate documentation and tools for creating these, for example <<Elements of a Mailto: URL>> this link is broken

Show a map for a location

If you know the latitude and a longitude of a location, you can show a map using an activity starter with these properties to show a map of the area:

Action: android.intent.action.VIEW
DataUri: geo:37.8,-122.23?z=23 

<< actually I would prefer the AI@ app put the remembered GPS location in the email, or as an attachment>>

 From here to end is not relevant to me>>

The format of the DataURI is specific to the app. In this example, the URI specifies a z (zoom) of 23, which is the largest zoom value. Zoom value is optional and ranges from 1 (the entire Earth) to 23.

If you know the zip code, you can set the activity starter properties as follows:

Action: android.intent.action.VIEW
DataUri: geo:0,0&q=94043

If you have a street address, you can use a DataUri that encodes the address with a scheme called URL encoding:

Action: android.intent.action.VIEW
DataUri: geo:0,0&q=5000% 20MacArthurBlvd%20Oakland%2CCA

Generally in URI encoding the only characters you have to replace are spaces ( %20 ) and punctuation marks, such as comma ( %2C ) and period ( %2E ).




here is code for email button

ActivityStarter2=android.intent.action.VIEW
Action

ActivityClass=com.google.gmail.gmailactivity

ActivityPackage=com.google.android.apps.gmail

DataType

DataUri=mailto:sa...@northpole.com?subject=Send Help&body=I Need Help
( this is a substitute email for now)

ExtraKey

ExtraValue

ResultName

What I am looking for is how to do the blocks code,

 If button Send email out put is pushed then....


I have not done blocks on my own yet, I am looking for help here not some one to write this code, just a shove in  the correct direction.

 I do have a working APK with out the emailer. I hope this is not too long winded.

Thank you again

SteveJG

unread,
Jan 30, 2015, 11:01:15 PM1/30/15
to mitappinv...@googlegroups.com
Taifun's example here will get your email:  http://puravidaapps.com/snippets.php#2email         Whatit does is sets up an email, then uses your email client to send it on the way and for you to include any additional text   ... yes, you must use the Send on the email client that pops up ... usually this is a Gmail client.

Try some blocks.  

Regards,
Steve

pat saturn

unread,
Jan 31, 2015, 1:24:44 AM1/31/15
to mitappinv...@googlegroups.com
Steve,
I see this example 
 What I do not understand is where did the green boxes under the mailto: box, labeled "txbEmailAddress.TEXT" come from, I do not have those in AI2.

Again it's the boxes that confuse me, I have no trouble following the logic, Just can not find those lighter green boxes any where in the box choices. was this example written in AI Classic?

I would have written a PHP mailer, but I do not know how to attach it to android to copy and send the GPS/ google map.

On my clients site I have a PHP mailer to get an appointment and a quote, I could extend it to get the motorists location and help request, it would be very simple to make it a bookmark in the motorists web browser, but I wanted to use an Android app.

 Thank you again.

SteveJG

unread,
Jan 31, 2015, 7:41:01 AM1/31/15
to
The green boxes are TextBoxes.  They have been renamed by Taifun.   Instead of  "txbEmailAddress.TEXT"  you can use   TextBox1.Text     and TextBox2.Text and TextBox3.Text for the other two.  All objects can be renamed from the values suggested by the compiler.  Some developers insist on providing formal names for controls ; others use the default names...it is a matter of style.

The TextBox is where the user adds the required information.   In your app, you could have hard coded information instead of these boxes or use a ListPicker etc. to provide the information that goes in those slots.

Taifun

unread,
Jan 31, 2015, 9:16:17 AM1/31/15
to mitappinv...@googlegroups.com
 I hope this is not too long winded.
actually it is...

if you are familiar with php, you also can use a php solution, see also 

Different eMail solutions for App Inventor

Taifun

Advice: Before posting, it's a good idea to search in this forum. Many others have likely run into problems similar to yours. How to search see screenshot.

pat saturn

unread,
Jan 31, 2015, 5:14:57 PM1/31/15
to mitappinv...@googlegroups.com
Steve,
 My pc was down earlier I tried to send a post. This is part of it.

 I realize the green boxes are text boxes, I just could not find this light green box, or how to edit it. are they the purple ones simply recolored light green.?

The author does not clarify;

Also I tried to merge AI@ files, ( wheres my car and email) with (AI2MergerApp), but it only saves the first aia file and does not merge. Has anyone had any success with AI2 Merge?

As I told Taifun, I may just end up using a PHP Mailer which I have written, Mine uses Godaddy servers where my clients web site is, so I may not work, although an earlier  PHP mailer that I wrote ( appointment form) is working for five years now.

I emailed Taifun, because my PC was down and I had only my android device, mail I sent here gave me an error ( not sent), so some of this may be a duplicate post. ( my apology)..

Thanks again
Pat S

pat saturn

unread,
Jan 31, 2015, 5:16:31 PM1/31/15
to mitappinv...@googlegroups.com
Taifun

Thank you again Sorry for the email earlier, My PC was Down and had to use an android device

SteveJG

unread,
Jan 31, 2015, 6:36:37 PM1/31/15
to
Perhaps before you continue jumping in the AI2 maze, perhaps you should do :

Tutorials:


and read the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  Together, the tutorials and especially the online free book answer  most of your questions.   You have programming skills...AI2 is a bit different.  Take the time to read how and get comfortable before you continue, perhaps?

Regards,
Steve

Reply all
Reply to author
Forward
0 new messages