Author Topic: ScriptBasic for Android  (Read 42797 times)

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #60 on: June 11, 2012, 07:12:47 PM »
I put Bertha the blow up Android emulator in the closet and got the real thing.  :o



Galaxy Tab 2 10.1

« Last Edit: June 13, 2012, 12:27:56 AM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #61 on: June 12, 2012, 01:42:04 PM »
I'm only developing the SL4A interface for Android 4.x based devices. I'm putting together a procedure on SB Google Code that will be a tutorial of sorts on how to install ScriptBasic (scriba and it's extension modules) on an un-rooted device. Scriba should run on earlier versions of Android regardless.

Script BASIC Project Manager

kryton9

  • Guest
Re: ScriptBasic for Android
« Reply #62 on: June 13, 2012, 11:09:44 AM »
Quote
I put Bertha the blow up Android emulator in the closet and got the real thing. 
John, I love your sense of humor!

Congratulations on your wonderful tablet. I think you got the best one out right now, so happy developing and testing on this beauty!

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #63 on: June 13, 2012, 02:19:27 PM »
Disclamer

At this point I'm not planning on rooting my Galaxy Tab 2 10.1 device. I find it more of a challenge to create a usable Linux terminal environment and still keep the device a virgin. I'm having fun finding out what the SGT2 can offer to scripting language environments like Python and SB. I think ScriptBasic has a fair chance at people taking the language seriously and using it to glue (customize) their digital world.

Root Access - SGT2

Root is similar to Apple Iphone’s Jailbreak. Thus Jailbreak gives the user the ability to change theme, download apps from 3rd party app stores – it still doesn’t give you that amount of power that you’ve achieve when rooting your device.
As i’ve said in the previous article – this is at your own risk!



This is for the Samsung Galaxy Tab! – In order to achieve root on this device, you must first synch it with kies, then disconnect it, then enable USB debugging mode and the launch an homebrewed program called “SuperOneClick” – with that press “ROOT” and you’re rooted! However you’ve still doesn’t have any Custom Kernel or recovery system installed at the moment, this can be done by using the software called “ODIN”.

As you can see – the Samsung device is A LOT easier to Root than the HTC device. This generally applies to all HTC’s and Samsung Devices.

1)      Install Samsung Kies – this is used for installing the necessary drivers that we are going to use for the Samsung Galaxy Tab.

2)      Synchronize your Tablet with Kies, just once would be enough to install the drivers. Disconnect the Tablet. Please ensure that you’ve doesn’t use any other launcher other than the default Touchwizz launcher! Many have reported that the Tablet won’t synchronize, but that’s just due to Samsung that have made the software capable of only detecting the device when running the default launcher/home replacement.

“It is important to install the drivers correctly in order to have any communication with the device. The method for HTC devices is similar as the Samsung devices.”
Script BASIC Project Manager

kryton9

  • Guest
Re: ScriptBasic for Android
« Reply #64 on: June 13, 2012, 09:14:14 PM »
Don't get caught up in all the rooting hype. I am glad I didn't root my tablet and although I like the stuff on my rooted phone, it is not stable and if I could go back to the stock ROM I would. It is just so easy to get caught up with it reading the articles and watching the videos on youtube.  Just look at that red sign you got in your post. Those will keep you out of trouble and happier!

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #65 on: June 15, 2012, 02:36:56 AM »
I haven't run into any show stoppers so far getting SB installed on my SGT2_10.1 Android device. I was able to get scriba to generate configuration files where I wanted them to go.



Notice the short lib name?




Here are a few apps I installed to make my life easier.

ConnectBot




DroidEdit



I would highly recommend Hacker's Keyboard as your virtual keyboard alternative.

Code: [Select]
IMPORT DVM

PRINT "Phone Type: ",DVM::getPhoneType(),"\n"
PRINT "Screen Brightness: ",DVM::getScreenBrightness(),"\n"
PRINT "Airplane Mode: ",DVM::checkAirplaneMode(),"\n"
PRINT "Ringer Silent Mode: ",DVM::checkRingerSilentMode(),"\n"
PRINT "Screen On: ",DVM::checkScreenOn(),"\n"
PRINT "Max Media Volume: ",DVM::getMaxMediaVolume(),"\n"
PRINT "Max Ringer Volume: ",DVM::getMaxRingerVolume(),"\n"
PRINT "Media Volume: ",DVM::getMediaVolume(),"\n"
PRINT "Ringer Volume: ",DVM::getRingerVolume(),"\n"
PRINT "Vibrate Mode: ",DVM::getVibrateMode(),"\n"
PRINT "Vibrate Mode Ringer: ",DVM::getVibrateMode(TRUE),"\n"
PRINT "Vibrate Mode Notify: ",DVM::getVibrateMode(FALSE),"\n"



Note:  The size of this last image is very close to my actual screen size for the tablet. (based on my laptop 1280x800 screen)

« Last Edit: June 15, 2012, 03:17:40 PM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #66 on: June 15, 2012, 09:37:17 PM »
Don't get caught up in all the rooting hype. I am glad I didn't root my tablet and although I like the stuff on my rooted phone, it is not stable and if I could go back to the stock ROM I would. It is just so easy to get caught up with it reading the articles and watching the videos on youtube.  Just look at that red sign you got in your post. Those will keep you out of trouble and happier!

If your want to play root, do it in an emulator to see what you're unable to on the stock device. I'm pondering why sudo (or it's mechanism to allow temporary root functionality) can't be added/enabled on this open source OS. I'm sure there are certain Android applications that are purchased from the marketplace that need root functionality to install. It's hard to believe this functionality isn't available and forces users to burn a new OS image and voiding the warranty. Why doesn't device manufactures just allow root by default and provide a factory reset option that restores the device like it was when you took it out of the box. (doing a backup first would be wise)

« Last Edit: June 15, 2012, 10:01:14 PM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #67 on: June 16, 2012, 10:30:45 PM »
I got tired of sharing the screen with the keyboard when at my desk so I got a Logitech® Bluetooth® keyboard and the case acts as a stand.



Quote from: product feedback comment
Just bought the keyboard at a frys after looking at the Samsung Galaxy Tab 10.1 keyboard dock (which is pretty ugly and from that the reviews say does not even work all the time). So far this baby is one of the best keyboards I've used and makes typing a pleasure on the my galaxy tab 10.1. I would recommend it to anyone planning on doing much typing on their tablet.

I was worried I was going to have to install a null virtual keyboard so it wouldn't pop up all the time. Android 4.x is smart enough to know you have an external KB attached and keeps the virtual one at bay unless you force it to be displayed by taping on the keyboard icon. Just like a PC, if I press a key while it is asleep the screen turns on like I pressed the power button. (Sweet !)

I created a new Android image for the emulator that matches my SGT2_10.1 screen size. I use a window scale .80 to allow the emulator to take the same screen real estate on my laptop as it does physically.

Laptop = 15" screen
Tablet = 10" screen

It's convent that the the tablet and my laptop both run at 1280 x 800 resolution. (tablet has better pixel density) Xfinity TV (Comcast On-Demand) runs great on the tablet and it's like having your TV in your hand. You can also use the tablet to view channel line-up and program your DVR. (both Android free apps)


« Last Edit: June 16, 2012, 10:38:15 PM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #68 on: June 17, 2012, 01:51:44 PM »
When I started looking for a Android tablet and settled on the Samsung Galaxy Tab 2 10.1, my next decision was broadband mobility. I could buy the unit from one of the carriers (AT&T, Verizon, ...) or save a lot of money and get the 4G compatible WIFI version. (from Costco) As long as I'm home and connect via WIFI to my Comcast router (21 MBits/sec) or at Starbucks via their AT&T 4G WIFI, I still had a leash. If I would have purchased one of the carrier units, I still had to sign up for their data plan @ $50 / month. (5 GB)  

The solution I went with is the AT&T Mobile Hotspot Elevate 4G ($119 for the modem, $50 /5 GB, 2 yr. contract, $35 activation & shipping)
 


Quote
Experience 4G LTE speeds on all your Wi-Fi enabled devices. AT&T Mobile Hotspot Elevate 4G connects up to five Wi-Fi enabled devices to the Internet with speeds up to 10x faster than 3G. With no software to install and an LCD screen to guide you, setup is fast and intuitive. Just turn on the device and connect your laptop (or another Wi-Fi enabled device) over Wi-Fi. AT&T Mobile Hotspot Elevate 4G helps you get the information you need quickly while away from your home or office, even when traveling abroad.
Script BASIC Project Manager

kryton9

  • Guest
Re: ScriptBasic for Android
« Reply #69 on: June 17, 2012, 05:47:57 PM »
I am sorry I forgot to mention about Hacker's keyboard. That is my favorite that I have found so far too. But I agree, nothing compares to having an actual keyboard.
I didn't know about droidedit. That looks nice. But I am not using my tablet for coding, just media viewer and reader for bedtime now.

Your bluetooth keyboard and your case as stand for your tablet looks like a very sweet combo, congrats!

That is really nice that you are documenting your experience along the way. This kind of info is very helpful when researching. So I am sure many people will find this info beneficial when doing searches.


support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #70 on: June 26, 2012, 12:30:23 AM »
I added an ANSI screen attribute library to ScriptBasic. It runs fine on both Ubuntu and Android Linux.



Scripting the Android device remotely on Ubuntu.



Code: [Select]
' SL4A and console screen mnemonics demo

IMPORT DVM
INCLUDE "ansi.inc"

CLS

PRINT GRAPHICS_ON
PRINT "l",STRING(38,"q"),"k"
FOR i = 2 TO 15
  PRINT AT(1,i),"x",AT(40,i),"x"
NEXT i
PRINTNL
PRINT "m",STRING(38,"q"),"j"
PRINT AT(1,3),"t",STRING(38,"q"),"u"
PRINT AT(30,3),"w"
FOR i = 4 TO 15
  PRINT AT(30,i),"x"
NEXT i
PRINT AT(30,i),"v"
PRINT GRAPHICS_OFF

PRINT AT(2,2),BOLD,COLOR(7,4,STRING(10," ") & "SAMSUNG Tab 2 10.1" & STRING(10," "))
PRINT AT(2,4),BOLD,COLOR(7,6," Phone Type" & STRING(17," "))
PRINT AT(2,5),BOLD,COLOR(7,6," Screen Brightness" & STRING(10," "))
PRINT AT(2,6),BOLD,COLOR(7,6," Airplane Mode" & STRING(14," "))
PRINT AT(2,7),BOLD,COLOR(7,6," Ringer Slient Mode" & STRING(9," "))
PRINT AT(2,8),BOLD,COLOR(7,6," Screen On" & STRING(18," "))
PRINT AT(2,9),BOLD,COLOR(7,6," Max Media Volume" & STRING(11," "))
PRINT AT(2,10),BOLD,COLOR(7,6," Max Ringer Volume" & STRING(10," "))
PRINT AT(2,11),BOLD,COLOR(7,6," Media Volume" & STRING(15," "))
PRINT AT(2,12),BOLD,COLOR(7,6," Ringer Volume" & STRING(14," "))
PRINT AT(2,13),BOLD,COLOR(7,6," Vibrate Mode" & STRING(15," "))
PRINT AT(2,14),BOLD,COLOR(7,6," Vibrate Mode Ringer" & STRING(8," "))
PRINT AT(2,15),BOLD,COLOR(7,6," Vibrate Mode Notify" & STRING(8," "))

PRINT AT(33,4),DVM::getPhoneType()
PRINT AT(33,5),DVM::getScreenBrightness()
IF DVM::checkAirplaneMode() = "false" THEN
  PRINT AT(33,6),COLOR(1,0,"false")
ELSE
  PRINT AT(33,6),COLOR(2,0,"true")
END IF
IF DVM::checkRingerSilentMode() = "false" THEN
  PRINT AT(33,7),COLOR(1,0,"false")
ELSE
  PRINT AT(33,7),COLOR(2,0,"true")
END IF
IF DVM::checkScreenOn() = "false" THEN
  PRINT AT(33,8),COLOR(1,0,"false")
ELSE
  PRINT AT(33,8),COLOR(2,0,"true")
END IF
PRINT AT(33,9),DVM::getMaxMediaVolume()
PRINT AT(33,10),DVM::getMaxRingerVolume()
PRINT AT(33,11),DVM::getMediaVolume()
PRINT AT(33,12),DVM::getRingerVolume()
IF DVM::getVibrateMode() = "false" THEN
  PRINT AT(33,13),COLOR(1,0,"false")
ELSE
  PRINT AT(33,13),COLOR(2,0,"true")
END IF
IF DVM::getVibrateMode(TRUE) = "false" THEN
  PRINT AT(33,14),COLOR(1,0,"false")
ELSE
  PRINT AT(33,14),COLOR(2,0,"true")
END IF
IF DVM::getVibrateMode(FALSE) = "false" THEN
  PRINT AT(33,15),COLOR(1,0,"false")
ELSE
  PRINT AT(33,15),COLOR(2,0,"true")
END IF

PRINT AT(1,18)
LINE INPUT z

  • CLS - Clear screen and home the cursor. (x1:y1)
  • COLOR(fg,bg,text) - Set the foreground, background and text to be displayed in color.
  • AT(x,y) - Position the cursor to the (x:y) position on the screen.
  • NORMAL - Return attributes to the default state.
  • BOLD - Bold the text follow the attribute.
  • UNDERLINE_ON - Start underline text mode.
  • UNDERLINE_OFF - End  underline text mode.
  • REVERSE_ON - Start reverse video mode.
  • REVERSE_OFF - End reverse video mode.
  • INS - Insert a blank character at the current cursor position moving the text to the right.
  • DEL - Delete a character at the current cursor position and shift text to the left.
  • INS_LINE - Insert a blank line on the row the cursor is at and shift lines of text down.
  • DEL_LINE - Delete a line on the row the cursor is at and shift lines of text up.
  • GRAPHICS_ON - Switch to the graphics/line draw character set.
  • GRAPHICS_OFF - Return back to the standard charater set.
Note: All of the above screen attributes are in the form of a string. (except CLS)

ansi.inc
Code: [Select]
' Console Display Enhancement Library

SUB CLS
  PRINT "\033[2J\033[1;1H"
END SUB

FUNCTION COLOR(fg,bg,text)
  COLOR = "\033[" & (fg + 30) & ";" & (bg + 40) & "m" & text & "\033[0m"
END FUNCTION

FUNCTION AT(x,y)
  AT = "\033[" & y & ";" & x & "H"
END FUNCTION

GLOBAL CONST NORMAL = "\033[22m"
GLOBAL CONST BOLD = "\033[1m"
GLOBAL CONST UNDERLINE_ON = "\033[4m"
GLOBAL CONST UNDERLINE_OFF = "\033[24m"
GLOBAL CONST REVERSE_ON = "\033[7m"
GLOBAL CONST REVERSE_OFF = "\033[27m"
GLOBAL CONST INS = "\033[1@"
GLOBAL CONST DEL = "\033[1P"
GLOBAL CONST INS_LINE = "\033[1L"
GLOBAL CONST DEL_LINE = "\033[1M"
GLOBAL CONST GRAPHICS_ON = "\033(0"
GLOBAL CONST GRAPHICS_OFF = "\033(B"

« Last Edit: June 26, 2012, 07:41:26 PM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 859
    • Script BASIC Open Source Project
Re: ScriptBasic for Android
« Reply #71 on: July 09, 2012, 05:28:13 PM »
If you have a Bluetooth keyboard for your Android device and the CAPS is sticking for you, download Dre’s Bluetooth Keyboard.apk to solve the problem. It worked for my Samsung Galaxy Tab 2 10.1 using ConnectBot and SL4A TERM. I didn't notice the problem as often with e-mail and browser forms. It seems the keyboard gets out of sync with the terminal app and works in the opposite way.

« Last Edit: July 09, 2012, 06:28:20 PM by support »
Script BASIC Project Manager