View Full Version : Google App Inventor
ardhuru
- 9th December 2011, 04:58
Wondering if anyone has any experience with the Google App Inventor?
I'd like to build a very simple app that displays a numeric keypad, and then simply outputs it to the phone's bluetooth.
Apparently from what I read, the App Inventor is a very simple package to develop Android apps, without having to go the Eclipse way. Also pretty much designed for the hobbyist, as it has canned commands to control Lego Mindstorms, letting you use all sensors on the Android in your project.
Would love to share information if anyone's been at it.
Regards,
Anand Dhuru
mackrackit
- 9th December 2011, 07:51
The App Inventor is/was "OK", but the future of it is questionable. Google is shutting it down. MIT is going to do something with it though. The way it is with Google everything is online, that may or may not be a good thing. It also seemed to be a bit limited in what you could do, IMHO. Kind of like using a "site builder" for a web site.
Have you seen B4A?
http://www.basic4ppc.com/index.html
I am really liking it. One of the nice features is the ability to debug on a device over your lan.
If you do decide to go with B4A use coupon code "bovvkr" to get %50 off the enterprise edition.
ardhuru
- 9th December 2011, 08:03
Thanks for the information, Dave.
The main thing that atrracted me to App Inventor was the ease with which one can use modules like BT, light sensor, accelerometer and so on, especially BT. How easy is it to use bluetooth with B4A? Have you used it?
At the price though, after the discount, it does look too tempting to pass.
BTW, as of September XX, I believe App Inventor is now hosted on the MIT server, and fully usable, so the accessibility should not be a problem, at least in the near future.
If you have used B4A, I would love to know your specific usage(s), as also about the learning curve, before I take the plunge.
Regards,
Anand
mackrackit
- 9th December 2011, 08:30
I have not used BT yet. Used the GPS, compass/accelerometer, write/read to storage... Currently I am working on a database app for an archaeologist that will record position and user entered attributes, with the ability to sync the data once the device is back into cell/wifi range. The learning curve for me was less than App Inventor. I never really made anything useful with App Inventor... But that is me.
Here is the code for a test app when I started playing with the GPS and the other orientation things.
The apk is attached if you want to see what it does.
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim GPS1 As GPS
Dim Orientation As PhoneOrientation
'Compass Stuff
Dim Angle As Float
Dim Timer1 As Timer
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
Dim Button2 As Button
Dim Button3 As Button
Dim Button4 As Button
Dim ScrollView1 As ScrollView
Dim lblAcu As Label
Dim lblAlt As Label
Dim lblLat As Label
Dim lblLon As Label
Dim lblSatellites As Label
Dim lblSpeed As Label
Dim pnlTest As Panel
Dim Alt As Double
Dim Rate As Double
Dim Acu As Double
Dim Latx As Double
Dim Lonx As Double
Dim now As Long
Dim lblBear As Label
Dim lblCompass As Label
'Compass Stuff
Dim csvCompass, csvNeedle As Canvas
Dim bmpCompass, bmpNeedle As Bitmap
Dim imvCompass, imvNeedle As ImageView
Dim RectCompass, SRectNeedle, DRectNeedle As Rect
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
ScrollView1.Panel.LoadLayout("scrollviewlayout")
ScrollView1.Panel.Height = pnlTest.Height
EditMode
If FirstTime Then
GPS1.Initialize("GPS")
End If
If File.ExternalWritable = True Then
Msgbox("Can write to SD storage card!", "")
Return
End If
WriteTextWriter
End Sub
Sub Activity_Resume
If GPS1.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device.", True)
StartActivity(GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
GPS1.Start(0, 0) 'Listen to GPS with no filters.
End If
Orientation.StartListening("Orientation")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
GPS1.Stop
Orientation.StopListening
End Sub
Sub GPS_LocationChanged (Location1 As Location)
lblLat.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude)
lblLon.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude)
Latx = Location1.Latitude
Lonx = Location1.Longitude
' 1 meter per second = 2.23693629 miles per hour
Rate = Round2(Location1.Speed * 2.23693629,3)
lblSpeed.Text = "Speed (MPH)= " & Rate
' 1 meter = 3.2808399 feet
Alt = Round2(Location1.Altitude * 3.2808399,3)
lblAlt.Text = "Altitude (Feet)= " & Alt
Acu = Round2(Location1.Accuracy * 3.2808399,3)
lblAcu.Text = "Accuracy (Feet)= " & Acu
lblBear.Text = "GPS Bearing = " & Location1.Bearing
End Sub
Sub GPS_UserEnabled (Enabled As Boolean)
ToastMessageShow("GPS device enabled = " & Enabled, True)
End Sub
Sub GPS_GpsStatus (Satellites As List)
lblSatellites.Text = "Satellites:" & CRLF & _
"# SNR Used Azi Elev" & CRLF
For i = 0 To Satellites.Size - 1
Dim Satellite As GPSSatellite
Satellite = Satellites.Get(i)
lblSatellites.Text = lblSatellites.Text & CRLF & Satellite.Prn & _
" " & Satellite.Snr & " " & Satellite.UsedInFix & " " & Satellite.Azimuth _
& " " & Satellite.Elevation
Next
End Sub
Sub Button1_Click
WriteTextWriter
Msgbox("The date is: " & DateTime.Date(now) & CRLF & _
"The time is: " & DateTime.Time(now), "")
End Sub
Sub Button2_Click
ReadStringExample
End Sub
Sub ReadStringExample
Msgbox(File.ReadString(File.DirRootExternal, "MAC_GPS.txt"), "")
End Sub
Sub WriteTextWriter()
now = DateTime.Now
Dim TextWriter1 As TextWriter
TextWriter1.Initialize(File.OpenOutput(File.DirRoo tExternal,"MAC_GPS.txt", True))
' For i = 1 To 10
' TextWriter1.WriteLine("Line" & i)
' Next
TextWriter1.WriteLine("Date = " & DateTime.Date(now))
TextWriter1.WriteLine("Time = " & DateTime.Time(now))
TextWriter1.WriteLine("Lat = " & Latx)
TextWriter1.WriteLine("Lon = " & Lonx)
TextWriter1.WriteLine("Alt = " & Alt)
TextWriter1.WriteLine(" ")
TextWriter1.Close
End Sub
Sub Orientation_OrientationChanged (Azimuth As Float, Pitch As Float, Roll As Float)
lblCompass.Text = "Compass = " & Azimuth
Angle = Azimuth
Timer1_Tick
End Sub
Sub Timer1_Tick
csvNeedle.DrawRectRotated(DRectNeedle,Colors.Trans parent,True,1,0)
csvNeedle.DrawBitmapRotated(bmpNeedle,SRectNeedle, DRectNeedle,0)
csvCompass.DrawBitmapRotated(bmpCompass,RectCompas s,RectCompass,-Angle)
imvCompass.Invalidate2(RectCompass)
End Sub
Sub EditMode()
'Compass Stuff
Dim x, y As Float
bmpCompass.Initialize(File.DirAssets,"compass.png")
bmpNeedle.Initialize(File.DirAssets,"needle.png")
imvCompass.Initialize("")
imvCompass.Bitmap = bmpCompass
imvNeedle.Initialize("")
imvNeedle.Color=Colors.Transparent
x = 30 ' (100%x - bmpCompass.Width)/2
y = 410 '(100%y - bmpCompass.Height) / 2
ScrollView1.Panel.AddView(imvCompass, x, y, bmpCompass.Width, bmpCompass.Height)
ScrollView1.Panel.AddView(imvNeedle, x, y, bmpCompass.Width, bmpCompass.Height)
csvCompass.Initialize(imvCompass)
RectCompass.Initialize(0, 0, bmpCompass.Width, bmpCompass.Height)
csvNeedle.Initialize(imvNeedle)
x = (bmpCompass.Width - bmpNeedle.Width)/2
y = (bmpCompass.Height - bmpNeedle.Height)/2
SRectNeedle.Initialize(0, 0, bmpNeedle.Width, bmpNeedle.Height)
DRectNeedle.Initialize(x, y, x + bmpNeedle.Width, y + bmpNeedle.Height)
Timer1.Initialize("Timer1",200)
Timer1_Tick
End Sub
dhouston
- 9th December 2011, 11:50
Anand,
I've been too busy with 15 different PCB prototypes to spend much time with B4A so I can't add to what Dave has said but everyone I know who has it has been impressed. There's a user forum (http://www.basic4ppc.com/forum/) that should give you a good idea of how it is used and how well it is supported. Anybody familiar with any dialect of procedural Basic (and especially VB) should find it easy to learn.
ardhuru
- 9th December 2011, 12:43
Dave (macrackit), thanks for the code; a working piece of code should be an excellent starting point while learning.
Dave (Houston), I remember you had referred to B4A in an earlier thread as well, and had meant to try it out back then, but somehow got relegated to the background. I see from the forums and the projects sub-section that people have done some pretty fancy things with B4A. What I need seems pretty trivial in comparison, so I'm pretty sure its doable.
I'll report back with the progress as I go.
Thanks, guys.
Anand
mackrackit
- 9th December 2011, 19:36
Here is the whole project, graphics and all.
ardhuru
- 15th December 2011, 06:14
Here I am, back as promised. Finally got the app done in App Inventor, and am pretty pleased with the results.
It does what I want well; send an ascii character over BT for each button pressed. Its supposed to be used as a numeric keypad for access control.
I would still be looking up Basic4Android (or other alternates) for a couple reasons, though.
1) Apps created with App Inventor cannot be installed to the SD card. (Not without a tweak, anyway)
2) The apk file size is not very compact; I've read it can be as much as 6 to 10 times larger than the same app developed in say, B4A.
3) Of course the degree of uncertainty regarding its new home at MIT; it goes off the Google site on the 31st.
Dave, your zip file would be the ideal starting point for me to get into B4A, thanks. Although it does look a bit daunting..
Regards,
Anand
6173
mackrackit
- 15th December 2011, 13:17
Dave, your zip file would be the ideal starting point for me to get into B4A, thanks. Although it does look a bit daunting..
It is not as bad as it looks. Most of the stuff in the zip was created by B4A.
ardhuru
- 15th December 2011, 18:00
Oh okay, I will take the plunge then.
Also found their pdf manual to be a great way to start.
Regards,
Anand
prstein
- 16th December 2011, 01:35
Dave,
Thank you, thank you, thank you telling us about B4A! Trying to create Android apps using Eclipse and Java was driving me up a tree. I've purchase it and am absolutely delighted with it so far.
You remain the best!
Best Regards,
Paul
ardhuru
- 11th January 2012, 12:58
Dave, thanks for the discound coupon code.
Took the plunge, and just finished installing B4A. As you said, its not as complex as the first impressions suggest.
Now, for the uphill trek...
Regards,
Anand
ardhuru
- 12th May 2012, 14:32
Dave (M), and Dave (H), thank you guys, for pointing me in the right direction.
After struggling with B4A for some time, I managed to accomplish precisely what I had in mind, and more.
I now have an apk that acts like a numeric keypad for access control.
As what often happens when one learns a new environment, I went overboard with some bells and whistles which were not planned on. (Automatic enabling/disabling of the bluetooth in my Android on app launch, text-to-speech annotations and so on)
I'm sure an expert will still find it very rough at the edges, but it serves my purpose well.
6480
If anybody would like to play around with this (remember, you'll need a bluetooth module to talk to), please pm me.
Again, thanks.
Anand
mackrackit
- 13th May 2012, 01:13
COOL!
I am glad it is working out.
DDDvvv
- 11th January 2013, 23:04
this Basic4android is indeed a great program. i just got done compiling my first app, and took me a couple of days, with the trial version.
i went ahead and shelled the 49 bucks for the enterprise version (after a 50% coupon).
so, im going to play it forward; heres a 50% coupon code, for the enterprise version; dnjqip :smile:
im trying to make an app that will allow me to use an android device as an lcd and keypad, and communicate with a pic18 by use of a bluetooth module.
if anyone has succeeded with this, please advise.
thanks
mackrackit
- 11th January 2013, 23:07
so, im going to play it forward;
cool!!!! :)
Charlie
- 12th January 2013, 03:10
I've been playing with B4A and it's quite polished and usable.
Having said that, poking around the web, I discovered this: http://www.laughton.com/basic/ It's considerably simpler, free, and has a growing community of users. By simpler, I mean more like traditional procedural basic programming, where B4A is more like object oriented Visual Basic.
RFO Basic programs are written on the actual Android device - which can be cumbersome, I admit, however you can also use a text editor on your PC then move your app over to the SD card. It does have nice tools for graphics and for BlueTooth and other hardware devices/interfaces.
Anyway, I thought I'd mention it and see if there is anyone else using it...
Ioannis
- 12th January 2013, 11:22
I guess I am the one here that is not happy with the B4A.
Cannnot by any means, whatever tried (from the support forum) to make the simulator run.
My setup is a SSD disk for the system and a RAID 0+1 for the data based on mechanical disks. Have tried also on a laptop with Vista and XP (with just one disk) but no joy.
If anyone had similar experience solved please help.
Ioannis
Normnet
- 12th January 2013, 13:17
I'm new to programming apps for Android and would like to know if my project is possible.
Can Android phone's be programed with B4A to send voice messages over WiFi only (no cell tower) to other phones?
Also does anyone know of sub $100 disposable phones which would work for this purpose?
They are to be used in the workplace were several are lost.
Norm
mackrackit
- 12th January 2013, 17:26
I guess I am the one here that is not happy with the B4A.
Cannnot by any means, whatever tried (from the support forum) to make the simulator run.
My setup is a SSD disk for the system and a RAID 0+1 for the data based on mechanical disks. Have tried also on a laptop with Vista and XP (with just one disk) but no joy.
If anyone had similar experience solved please help.
Ioannis
Can you get the emulator started stand alone ? It is very slow but has nothing to do with B4A. It is a google java thing.
Try debugging directly to a device, it is much faster.
Ioannis
- 12th January 2013, 20:25
Hi Dave.No it does not and I have not yet available a real device. Soon I will.
The problem has something to do with the installation path. My sysytem disk is C: on a SSD disk and the installation directory on D:. I even tried to declare Environment Variable to declare the path but in vein. No joy yet.
Hope to try in real device soon.
Ioannis
prstein
- 12th January 2013, 21:48
im trying to make an app that will allow me to use an android device as an lcd and keypad, and communicate with a pic18 by use of a bluetooth module.
if anyone has succeeded with this, please advise.
thanks
Haven't done that precisely, but I done similar projects. Android + BT + PIC is a great combination.
I, for one, am as pleased with B4A as I am with PBP.
Best Regards,
Paul
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.