Updated 2018-01-14 11:02:24 by teknokrat

GWL 6/6/2014, Has anyone done a APK of AndroWish+TkChat? If so, is it available for download?

chw 2014-12-20: there's a standalone APK of TkChat in http://www.ch-werner.de/AndroWish/TkChat-debug.apk which requires an installed AndroWish.

JM 3/15/2014, How do I set the HOME env var so I place my .wishrc there? It should be something simple but I could no set what is described like this in Androwish:

wrote a trivial .wishrc ("puts hello") in /sdcard/home (because Jota+ doesn't let me edit in /data), let AndroWish copy it to $HOME, restarted.. and got "hello" :D Excellent.

For file transfer, I'd prefer my $HOME on sdcard0 or sdcard1 (those get mounted on netbook when USB-connected - but not /data and below that). Solution: I have a small file .wishrc in /data/data... which contains
set env(HOME) /sdcard/home
cd ~
source wishrc.tcl

And that latter file will contain the real customizing code.

Answering to myself... Everything was there, I was probably missing some more wording to get the idea. rewriting it here:

wrote a trivial .wishrc ("puts hello") in /sdcard/home (because Jota+ doesn't let me edit in /data), copy it to $HOME (you may even use Androwish for that)
file copy .wishrc /data/data/tk.tcl.wish/files/ 

restarted.. and got "hello" :D Excellent.

For file transfer, I'd prefer my $HOME on sdcard0 or sdcard1 (those get mounted on netbook when USB-connected - but not /data and below that). Solution: I have a small file .wishrc in /data/data/tk.tcl.wish/files/ which contains:
set env(HOME) /sdcard/home
cd ~
source wishrc.tcl

And that latter file will contain the real customizing code.

4/4/2014 btw, my wishrc.tcl is like this:
sdltk textinput on
set script [tk_getOpenFile]
if {$script != ""} {
  source $script
  console hide 
} else {
  puts "hello!"
}

As the few scripts I am playing with are not using the console...

JM 3/19/2014,I am reading that Regarding orientation a <Configure> event handler on a toplevel with "wm attributes -fullscreen 1" might detect changes in screen orientation.

Could you provide an example for that?

chw 2014-03-20: try this code snippet:
proc configure_event {w} {
    set ::conf "W x H: [winfo width $w] x [winfo height $w]\n"
    append ::conf "phys.: [winfo screenmmwidth $w]mm x [winfo screenmmheight $w]mm"
}

wm attributes . -fullscreen 1
label .l -textvariable ::conf
pack .l -side top -fill both -expand 1
bind . <Configure> {configure_event %W}

Important point: make the widgets in the toplevel to take up all space (to expand) in order to use the entire screen estate. Otherwise winfo width . and/or winfo height . are smaller. To get the pixel width/height of the screen, use winfo screenwidth . and winfo screenheight ..

pi31415 2014-03-23: I built sdl2wish8.6 on Linux/SDL2/DirectFB sans X11. I made a few small changes to fix the build with the latest SDL2, and without X11. It runs but quits at [package require Tk] with no output and exit code 1. Troubleshooting ideas are welcome.

chw 2014-03-24: please fetch the latest AndroWish sources which are built with libSDL 2.0.3 (patched e.g. for proper selection support on Android and X11). Regarding the early termination I'm afraid gdb is your best friend. Place breakpoints e.g. on SdlTkXOpenDisplay and SdlTkFontInit to see how far it goes.

pi31415 2014-03-24: Thanks for the suggestions. I used the load command to directly load libsdl2tk8.6.so and found that the early termination happened because I did not set the DISPLAY environment variable. tkSDL.c TkGetDefaultScreenName()

chw 2014-03-25: I see. That will be fixed in a later release. It will report ":0.0" in case the environment variable is not set since this makes much more sense under SDL.

[PBB] - 2014-03-26 17:47:38

Need help for running HelloTclTk in a Android Emulator. I have installed ADK ... on my Linux (Debian 7.1.0) and created a AVD (like NexusS) Unzip the HelloTclTk.zip and did the build and installed Latest (Mar-24-2014) AndroWish and HelloTclTk on the AVD. I can run AndroWish on the Emulator and tried the tk_MessageDialog which works correctly. Tried few other commands. Now if I click on HelloTclTk the screen goes blank for a few seconds and then returns to the menu screen. What am I missing ? How to debug this ? I even modified HelloTclTk tcl code to
console show
puts "111111111111111111111"
vwait v

No success. Is there a particular AVD setting I am missing or wrong.

chw 2014-03-27: What Android version is your AVD running? 2.3.3 could have issues since the emulation has poor GLES support. This is far better for 4.x devices. The reason for HelloTclTk terminating early could be that you did not install the latest. There are subtle version problems. The HelloTclTk must fit the AndroWish runtime. In general, adb logcat is your friend to be run on the development system.

[pbb] 2014-03-27: Thanks. It works now. I downloaded the latest HelloTclTk.zip and unzipped it. Edited local.properties to set he sdk.dir. Then changed project.properties target=android-15 as my AVD has Android 4.0.4 API 15. Build the code and installed it. I see that the ICON changes to that of AndroWish. It runs as expected. The previous HelloTclTk.zip I had was downloaded on Mar-8

escargo 2014-03-27: Is it possible to access the alarms on the device? If so, can they be manipulated (create, report, update, delete)?

chw 2014-03-28: good point, but not implemented right now. What about adding this to AndroWish: Ideas?

ET - 2014-04-16 10:35:44

I'm having the same problems with the /data/data directory. I can't browse to it using my sftp client nor cd to it using ssh client.

The solution above was not clear to me. And where does all the environment variables get set? How is HOME set? Is there a .bashrc (or is it just the sh shell). I haven't use sh for centuries, so I'm not sure how to get there from here.

Jorge - 2014-04-16 14:34:09

I understand /data/data/tk.tcl.wish/files/ is empty by default, or...it may only contain hidden files.

If you want something to be initially set when you launch Androwish, then you can create a file named .wishrc, and then copy it to /data/data/tk.tcl.wish/files/

to copy the file from wherever you created it, you can use Androwish like this:
 file copy .wishrc /data/data/tk.tcl.wish/files/

such file can indeed, set your home like this:
set env(HOME) /sdcard/home
cd ~

you can then restart Androwish and your .wishrc will be read and executed on start up.

escargo 2014-04-09

Is there a way to connect AndroWish with Android Voice Actions? My ultimate goal is to trigger complex timers through voice actions in a cafe bakery environment. My hands are often covered with gloves or flour, and touching a smartphone or table under such circumstances is not practical.

AMG: I must ask if your bakery serves escargot. ;^)

chw 2014-04-17 will try to implement something in this direction, seems similar in semantics to borg activity with callback. Reminds me of one of my favorite songs of a Bavarian band:
 Excuse me Sir, can you help me out?
 I wanna bake a cake but I don't know how.
 No I don't, but I'm sure I will
 so what do we need for your bakery?

 It's like dancing in the sun
 having trouble, having fun
 having anything you wish to come
 Then it suddenly smiles your way
 and you have an easy day.

Let's have an easy day.

ET - 2014-04-24 20:34:28

First, thankyou for AndroWish, I haven't had this much fun programming in quite some time.

Couple of things,

  • Is there an example of how to translate movement using <<FingerMotion>> to scroll a window? I see that the console window can scroll by quick up/down touch movements. Was that specially programmed into the console for Androwish? BTW, I think the difference %X %Y (or %x %y, forget which) only works when touch movements are moving down.

I have been playing with bwidgets and I built a scrollable window with a scrollable frame where I can place buttons that can be scrolled with the scrollbar. To be more android like, I should be able to slide these left/right in a frame to mimic how many apps do this.

A couple of minor problems:

  • Writing to the console can be especially slow on AndroWish, so I've made use of my console hack that lets me turn off scrolling. Otherwise, a statement such as parray env can take 3 or 4 seconds to complete with scrolling enabled.
  • I'm experiencing several refresh glitches. Button presses don't turn the background color back to normal after the button is released until the next time I update something, or give focus to another widget. Sometimes rotation (using the fullscreen example binding on <Configure> esp. portrait to landscape) leaves my screen half rendered. My workaround is to do a delayed setting (after 1000 [list set ::conf $c] where ::conf is the textvariable for a label) at the end of my <Configure> callback.

I realize this is early and so this might be a well known bug, but where is the best place to report these sorts of glitches.

But, I'm loving it. I got my first android tablet 2 weeks ago and in 1 week I am programming it in tcl/tk. Contrast this with trying to re-learn Java with a gazillion new classes to wade through. I've already built a few small apps using some tcl code for sockets that I've had lying around for years.

chw 2014-04-25 11:25:38: It should not be necessary to specially deal with <<FingerMotion>> since by default the sdltk touchtranslate is on (see AndroWish: Documentation for details). For text, listbox and entry widgets, that gives a usable standard behavior using emulation of mouse button 2 (and has the advantage not to require any changes in the standard bindings of these widgets). If you can implement a similar panning using mouse button 2 events in your code you'll have the benefit, that this will work on desktop platforms, too. Regarding slowness of the text output in the console I'm testing right now some improvements which (when ready) will be in the next AndroWish release. Regarding refresh glitches when the device is rotated: I have an ASUS tablet (Android 4.1) which shows similar behavior, the same scripts run on a Lenovo tablet (Android 4.2) work fine so this will not be easily tracked down.

ET - 2014-04-28 00:35:47

Thanks, I did get some buttons inside BWidgets scrolling up and down, though I'm sure there's a cleaner way. I ended up computing my own deltas from the %Y on <2> and subsequent <B2-Motion> events, and did a
if { $delta < 0 } {
    .top47.scr50.f yview scroll -1 units
} else {
    .top47.scr50.f yview scroll  1 units
}

for each motion event, ignoring the magnitude of the deltas. Going by units is not as smooth as Native Android in this regard, but it works well enough.

In the meantime, here's a hack I'm using to make the console work pretty well. It redefines ConsoleOutput to delay scrolling to at most 5 times a second. The tk::do_scroll is optional, as written it has no effect. I bind it to a checkbox I add to the console window. I also was able to increase the console text size now that it doesn't affect performance.
console eval {
    set ::tk::console::maxLines 5000 ;# optional
    set ::tk::console_flag 0
    set ::tk::do_scroll 1 ;# use console eval to set this if desired

    proc ::tk::console_hack {} {
        if {$::tk::console_flag && $::tk::do_scroll} {
            .console mark set insert end
            .console see insert
            set ::tk::console_flag 0
        }
        after 200 ::tk::console_hack
    }
    proc ::tk::ConsoleOutput {dest string} {
        set w .console
        $w insert output $string $dest
        ::tk::console::ConstrainBuffer $w $::tk::console::maxLines
        set ::tk::console_flag 1
    }
    after 200 ::tk::console_hack
}

mh2 (03.05.2014) Is it possible to load Tk package in (sub) interp ? Unfortunately this code
  interp create int1
  int1 eval {package re Tk}

does not work (tested on latest 8.4 androwish). Each intepr should have its own "." window. I was trying to add something to auto_path or to load some .so files without good result. Such a possibility is very convenient if we want to run external scripts... (probably tkgamepack.kit is working in this way). Best regards, mh2.

chw 2014-05-03: try this, hope that it works:
interp create -- int1
interp eval int1 {package unknown {}}
interp eval int1 [list package ifneeded Tk $tk_version {load {} Tk}]

interp eval int1 {
    set argv {}
    package require Tk
    ....
}

However, there might come up many new bugs and problems since I've never verified having multiple Tk instances running with SDL and the X11 emulation, but let's see.

mh2 It is enough to do "load {} Tk". Seems to work perfectly, we can have as many as we want Tk instances in a single androwish process!!! For example we can run at the same time 2 different games in "int1" and "int2". Thanks chw!

mh2 Unfortunatley, if we 1. create interp, 2. load Tk, 3. run a script, and 4. destroy interp, then there is a small memory leak ("ps" command shows that VSIZE RSS increase sligtly...).

ET - 2014-05-04 21:22:15

This is outstanding!

I’d begun building a mini-launcher using namespaces, but this was clumsy and the launchee had to be written accordingly. This is much cleaner using an interpreter. My launcher scans a subdirectory (launchees) and creates a page of buttons (eventually to be in a gesture scrollable bwidget frame), one for each of *.tcl in that directory and then a button push launches that file using the below ::_launcher_launch proc.

I had to create a few aliases inside the slave to deal with calls to the console and exit. We don’t want the launched program to truly exit, but we do want the slave interpreter it’s in to get deleted on an exit call. Only an exit from the master interpreter should exit AndroWish.

I use a procedure, lpr, that lets me copy proc’s into the slave. I copied in some debugging proc’s (lg and ltree2, not shown here) as a test. I made sure exit was redefined in the slave first. I don’t know if the after idle is really needed, but it seemed best if the code was sourced from the global event scope.

I tested it with a file created by Visual-Tcl (Am I the only one still using that?). I launched two instances of the same program, each in its own interpreter. Each one handled its own scrollable bwidget window/frames that responded to the finger motion events. Exit by closing the window or calling exit worked as expected.
proc ::_launcher_launch {who} { #launch a file from the launchees folder
    set file [file join [pwd] launchees $who]
    append file .tcl
    set inter [interp create]
    #puts "inter= |$inter| "
    interp alias $inter  console {} console ;# allows slave to use console
    interp alias $inter  ::_launcher_exit         {} _launcher_exit ;# this is called from redefined exit
    set do  ";[lpr lg];[lpr ltree2];set argc 1; set argv $inter; load {} Tk; "
        interp eval $inter "
            proc exit {} {
                puts \"called exit from $inter\"
                _launcher_exit $inter
                return 0
            }
        " $do "
            after idle source $file ;
    "
}
proc ::_launcher_exit {arg} { # called by slave, defined in master
    puts "launcher exit called with $arg" ;# arg is the slave interpreter id
    interp delete $arg
}

proc {lpr} {{namepat *}} { # reconstruct procedure(s) to copy into slave
    set output {}
    foreach proc [info procs $namepat] {
        set space ""
        append output  "proc $proc {"
            foreach arg [info args $proc] {
                if [info default $proc $arg value] {
                    append output  "$space{$arg $value}"
                } else {
                    append output  $space$arg
                }
                set space " "
            }
            append output  "} {"
            append output   [info body $proc]
        append output "}\n"
    }
    return $output
}

Just downloaded the latest with speech recognition. Is there a small example showing the use of this?

chw 2014-05-08: No

Wait. Try this:
proc myproc {result data} {puts "result=$result data=$data"}
borg speechrecognition {android.speech.extra.LANGUAGE_MODEL free_form} myproc

The result is made up of a list of key value pairs. When the result item is -1, data is another key value pair thing with the speech recognition result information. So right now I've spoken AndroWish sucks into my tablet and got
result=-1 data=android.speech.extra.RESULTS {{anrufen Fax} {anrufen sag} \
  {anrufen ich sag} {anrufen Fax an}} android.speech.extra.CONFIDENCE_SCORES \
  {0.94742095 0.0 0.0 0.0} query {anrufen Fax}

Not really impressing, but I didn't change the language of my tablet to be English, so they (Google?) interpreted it in Goethe's native language. So I've slightly modified the parameters:
borg speechrecognition {android.speech.extra.LANGUAGE_MODEL free_form android.speech.extra.LANGUAGE en_US} myproc

Et voila, that is output
result=-1 data=android.speech.extra.RESULTS {{andro which sucks} \
  {and roll which sucks} {andro wish f***} {central which sucks} \
  {entra which sucks}} android.speech.extra.CONFIDENCE_SCORES \
  {0.2972375 0.0 0.0 0.0 0.0} query {andro which sucks}

Reminds me heavily to work on my pronounciation although which and wish are not so different.

Ah, nice. Very nice!

Couple questions...

I take it that this command does action android.speech.action.RECOGNIZE_SPEECH and thus one cannot specify, say, android.speech.action.VOICE_SEARCH_HANDS_FREE, as that would be a different action.

I purposely misspelled free_form to see if I'd get an error back, but it seemed to not care. I did add a prompt, using android.speech.extra.PROMPT and that worked. So, feeling self assured, I entered, android.speech.extra.MAX_RESULTS 1 and it didn't seem to take that. It still returned several answers. Or do I have the meaning wrong here?

Will the final result, following query, always be a repeat of the one with the highest confidence score?

Besides for a -1, what other results are possible here? Is this -1 a result code, like, RESULT_NO_MATCH (value of 1)?

And a java thingy, am I right that something like LANGUAGE_MODEL_FREE_FORM is a string variable whose value is free_form, and it's this value we use in the borg command, not the constant's variable name (if that makes any sense). So the former is a compile time symbol and the later is the actual text string that is used at runtime.

chw 2014-05-09: have to see what android.speech.action.VOICE_SEARCH_HANDS_FREE really does. When it is useful I'll add another parameter to borg speechrecognition.

The free_form value is required according to the Android documentation, maybe there's some fallback behind the scene. Regarding the maximum number of results you should try to use {int android.speech.extra.MAX_RESULTS} 1 instead, otherwise 1 is put as a string into the intent extras which is the wrong type according to the documentation.

The result value is the generic intent result code of the speech recognition intent. -1 simply means successfully finished. Other values may indicate some error but I'm unsure.

All those keys in the argument list (which make up the intent extra data) are strings which are put into some hash map on the Java side. That hash map has string keys and Java objects as values. That is the reason I've added some type conversion (int, long, float, Uri, etc.).

ET - 2014-05-18 02:26:06

I just installed the "let it be" version and tried to use the udp package but I get this:
cannot find symbol "Tcludp_Init": Symbol not found: load_library(linker.cpp:746): library "libtcludp.so" not found
cannot find symbol "Tcludp_Init": Symbol not found: load_library(linker.cpp:746): library "libtcludp.so" not found
    while executing
"load libtcludp.so"
    ("package ifneeded udp 1.0.10" script)
    invoked from within
"package require udp "
    (procedure "testit" line 12)
    invoked from within
"testit"

Any ideas what's wrong?

chw 2014-05-18: Unfortunately, the pkgIndex.tcl of the UDP package is broken in the Let It be edition. Until this is fixed use this workaround:
load libtcludp.so Udp

ET Great, thanks, now I have my wake on lan going, see here AndroWish Feature Requests. I mentioned one minor issue; if I didn't close the socket before opening another one, AW would crash. I had adapted an existing example, which didn't close the socket because it just did an exit. I don't know if this is an AW problem or a UDP problem. To see the crash, one would just comment out the close at the bottom of the example.

ET - 2014-06-01 00:28:38

Is there any way to adjust gesture detection sensitivity?

When tapping a tk (or ttk) button, especially with my thumbs, AW will often interpret my button tap as touch and motion events and not invoke the code for a button. I do sometimes have this problem in other Android apps, but not nearly as often. It seems AW is more sensitive than other apps in this regard. With AW, I have to be very precise with touch down/up on a tk/ttk button.

I have created a workaround, to replace all my button callbacks with a bind on <<FingerUp>>
proc debounce  {{root .}} {
        set class [winfo class $root]
        if  { $class == "Button" || $class == "TButton" } {
                set cmd [$root cget -command]
                $root configure -command {}
                bind $root <<FingerUp>> [list after idle $cmd]
        }
        set children [winfo children $root]
        if { $children != "" } {
                foreach child $children {
                        debounce $child 
                }
        }
}

While this makes my button taps work at an acceptable rate it unfortunately conflicts with the use of gestures such as <<PinchToZoom>>.

I saw some Android documentation that seems to suggest there’s a gesture sensitivity setting, but only via java code. I couldn’t find an app that would let me adjust this globally.

Any thoughts?

AM - 2014-08-10 16:16:02

I have what must be a very simple question. I am using a listbox to display a list or items of variable length. How can I stop the window from scrolling left to right? When I "slow" scroll up and down, I cannot stop the window contents from scrolling left to right at the same time. I know it must be to do with <<FingerMotion>> but I cannot seem to work it out.

chw 2014-08-10: if you like to turn off horizontal scrolling by one finger wipe in your listbox you should override the <B2> and <B2-Motion> bindings for that individual listbox, e.g.
bind .mylistbox <2> {
    %W scan mark 0 %y ; break
}
bind .mylistbox <B2-Motion> {
    %W scan dragto 0 %y ; break
}

AM 2014-08-11: Thank you. I find a similar command in the canvas manual page, so it seems that these follow the same conventions. Very interesting.

AM 2014-10-04: I applied this code to my listbox and as I said it does the job perfectly, however I find a strange effect which may not be connected. I have a listbox on my first screen, tapping an item opens a text widget. If I run the code under wish on the PC then moving the mouse wheel forward (away from me) scrolls the listbox up to show the top of the list and the text widget does the same, showing the top of the text. Under androwish on the phone, swiping up the screen moves the text widget up to show the bottom of the widget, but on the listbox swiping up moves the list shown down, to show the top of the list, whereas I would have expected the opposite effect. This seems counter intuitive to me.

chw 2014-10-04: That is intended behavior like the swipe gestures on other Android apps. If you're in your list of SMSes and swipe up, the content of the list scrolls down and vice versa. It can be changed easily by flipping the sign of %y in the above example.

AM 2014-10-04: Strangely swiping on my SMSs works as expected, the opposite to swiping in my listbox. I will try reversing the direction in the code.

chw 2014-10-04: I'm afraid you've found a bug. For listboxes in AndroWish (not when compiled for desktop Linux) both X and Y axes are inverted in the code which simply is wrong. It will be fixed in the next release.

AM 2014-10-05: Thank you

AM - 2014-08-15 13:07:30

Not sure what the problem is, but I cannot get the on screen keyboard to come up. I used the HelloTclTk code and changed the label to an entry, just to make sure that it was nothing in the code in my application, and still, touching the entry box does not bring up the keyboard. In my own code I even tried "sdltk textinput on". Following up with "sdltk textinput" returned 1 - true but still no keyboard. (Android - SDK 17 Release 4.2.1)

chw 2014-08-15: it could be that your HelloTclTk template is too old (and I'm not sure, if that on http://www.ch-werner.de/sdltk/AndroWish/HelloTclTk is up to date). The underlying archive which unfortunately must match your installed AndroWish is .../libs/tcltkapplib.jar. When in doubt you can recreate it from the fossil repo on http://www.androwish.org. It's in the tcltkapplib subproject and only requires the Apache ant and Android SDK (not the NDK) for building. BTW: what is the output of "borg keyboardinfo"? Any error messages from "adb logcat"? Other possible reason: if you have activated a hardware keyboard (e.g. Bluetooth keyboard) the on screen keyboard isn't shown at all. PS: even simpler, the HelloTclTk template is checked in into the fossil repo, too, and that one matches the latest AndroWish from http://www.androwish.org.

AM 2014-08-16: quite right. Updated tcltkapplib.jar and it now works fine. Incidentally I could not find tcltkapplib.jar anywhere except in the HelloTclTk folder. Am I supposed to build it myself, and if so, how?

chw 2014-08-16: no, better use the prebuilt HelloTclTk template which is in sync with the current AndroWish. But you easily can rebuild the library for yourself following the instructions in http://www.androwish.org/index.html/artifact/1c010e56cf7449bf6117d12055abc21d8824c58e.

AM 2014-09-29: can you just tell me if tcltkapplib.jar is the only file I will need to update when a new release of Androwish is released? Sorry if this is a dumb question but I am learning all the time :-)

chw 2014-09-29: Not a dumb question. tcltkapplib.jar is a variant of AndroWish's Java glue code with a slightly different startup regarding loading of native shared libraries. This needs to be in sync with the installed AndroWish (until I will have found a better solution). The other important file is AndroidManifest.xml which declares the entry points into the App and sets up permissions, but this changes very infrequently.

[Kc] - 2014-09-30 06:56:00

Can anyone tell how to adjust screen brightness in androwish? I tried "borg content update" but it does not wo rk.May be done with wrong parameter.Please help!

chw 2014-09-30: There's currently no interface in AndroWish to achieve this.

[calm] - 2014-10-21 04:07:08

First: thank you CH Werner by androwish. You is my new hero. Tcl is my favorite programming language ever. I'll love to programming to Android. But, nothing is perfect. Some problems here:

-A freewrap for android solution to pack tcl scripts could be realy cool (using java?). The proposed http://www.androwish.org/index.html/wiki?name=HelloTclTk solution is not good because people can get angry by know they need download a extra 20 megs apk to get the new app they just download working properly (android depedency hell!).

-The android bar is not available whem running androwish so some times it hangs and the only way to get control to the phone back is by turning phone off an on (people really get furious on turn off their communication device).

Thank you again, great job.

chw 2014-11-18: Regarding a "freewrap" like solution I'm afraid this is not feasible due to the constraints given by Android's package management. So the second best solution is still to package up an app with few Java/Dalvik stuff and the tcl code and re-use the installed native infrastructure of the AndroWish package. If that is not what you want, then get the source code of AndroWish, strip off everything you don't need, and finally build your own package from it. When you want to target both ARM and x86 devices, be prepared that your resulting apk will still have a minimum size of about 10 MByte.

The missing title bar shouldn't be a problem at all since the home (hardware or soft) button is always visible and should allow you to navigate back to the home screen regardless of AndroWish's state.

[calm] 2014-12-22: Please, excuse my bad english. I understand your point about freewrap running from an android device, but I think it is feasible because I have tested an android ide named AIDE and it allow us to create and pack an android apk directly from the ide it self. But my idea on freewrap for androwish was creating the package (apk) from a Windows/Linux environment using pre-compiled androwish.

Although, in the meanwhile from my first post I got my self able to open an official androwish package (from your site), change any file inside it and repack it again with my own key. And it works like a charm. Problem is: it is accepetable? I mean can you allow me (and anybody else) to work this way? Again, thank you, androwish is great.

chw 2014-12-22: no problem with this approach except that you should ensure in your AndroidManifest.xml that your own package and app names are used and similar in the src subtree your own package and class names (which may be subclassed from tk.tcl.wish.AndroWish) are used. The reason is simply that these names are used by Android's package management to uniquely identify your app. And if you leave the original names in the apk you effectively prevent the install of the official AndroWish.

[Calm] 2015-01-05: Hello. About "The missing title bar" I mentioned above I have installed the new apk from the repository into my emulator and no "home (hardware or soft) button" is visible on the screen. I don't know if it is a problem with the emulator but is the same with all versions I have installed.

chw 2015-01-05: maybe this posting on stackoverflow helps: http://stackoverflow.com/questions/7628606/how-to-emulate-pressing-home-button-in-android-emulator

AM - 2014-11-15 10:14:23

I wonder if you could give me a hand using "sdltk textinput ?on|off ?x y ?hint???"

I want to turn on a specific keyboard when I tap on an entry widget, but "sdltk textinput on 0 0 4" returns an error referring to the cursor co-ordinates. The other problem I have is that I do not know how to specify the cursor position in an entry widget.

PS - thanks for the last update. Scrolling works as expected for me now.

chw 2014-11-18: Please recycle the code from the entry widget's bindings (in proc ::tk::EntryButton1) regarding "sdltk textinput". See http://www.androwish.org/index.html/artifact/fc4f9fac01abb4cbc4f96fc6d2f7baf3dbd95e39

AM 2014-11-23: Thanks for the link. I have used the hints but still have a few problems with calling a specific keyboard. As you would see with this code:
bind .value <1> {
    set bbox [%W bbox insert]
    set x [lindex $bbox 0]
    set y [lindex $bbox 1]
    catch {
        incr x [winfo rootx %W]
        incr y [winfo rooty %W]
        sdltk textinput 1 $x $y 4
    }
    tk_messageBox -message "Keyboard 4"
}

the numeric keyboard is loaded, but immediately after pressing OK on the message, it is overwritten by the alpha keyboard. I do not know why.

chw 2014-11-23: the bindings for <1> according to bindtags are all evaluated, and the last in that chain is the code for <1> for the Entry widget class which will bring up the standard keyboard. So better add a break at the very end of your specific binding for <1>.

MG 2014-11-18

What are the chances of getting a minimal AndroWish build? The list of supported packages is impressive, but rather bulky for every day use. It would be really nice to get a barebones version, maybe with the packages compiled and available as separate starkits that can be loaded into it as desired?

chw 2014-11-19: would be no problem if loading of native code would be similar to our usual Win32, UN*X, MacOSX platforms. And of course if distribution of additional stuff (including native code, i.e. "load"able stuff) were similar easy (i.e. not possibly constrained by permissions of the download or install location). Right now, the way is to get the source, strip off things you don't need, and rebuild it from sources to get a footprint you prefer.

[ggarrett] 2014-12-20

I have an application that needs to keep running without user interaction. How can I prevent the device from going to sleep? I've tried both sdltk screensaver off and tk inactive reset without success. I suppose I could build a HelloTclTk with the layout attribute android:keepScreenOn="true", but is there a way to do this in script?

chw 2014-12-20: the "sdltk screensaver" command is the way to go. It is now fixed in the trunk on http://www.androwish.org and will be available in the next release of AndroWish.

MG 2015-01-13

Someone has offered me a Linux build to try and build on, but I'm running into an error when running 'ant debug'
     [exec] [armeabi] Compile thumb  : tiff_tkimg <= tif_predict.c
     [exec] /tmp/cccO9gBB.s: Assembler messages:
     [exec] /tmp/cccO9gBB.s: Error: unaligned opcodes detected in executable segment
     [exec] make: *** [obj/local/armeabi/objs/tiff_tkimg/libtiff/tif_predict.o] Error 1

BUILD FAILED
/home/time/awmike/custom_rules.xml:89: exec returned: 2

Total time: 16 minutes 44 seconds

Anyone have any ideas what the issue might be?

What's the process for removing unneeded packages, by the way? Is it just a case of removing the folders in assets/ before building, or is there more needed? Thanks.

chw 2015-01-13: I'm using the NDK versions r6b and r9d both as x86 (32 bit) versions on CentOS 6 and Ubuntu 12.04 and never had such a problem.

When stripping down the source tree, you should move unnecessary subdirectories out of the .../assets folder e.g. into an .../unused-assets folder and rename the Android.mk files in the corresponding native code directories below .../jni to something like Android.mk-dont-build. When changing the structure that way better perform an "ant clean" and "ant debug" to get rid of left over stuff in the .../obj and .../libs folders.

Please add a subclass of tk.tcl.wish.AndroWish below the .../src folder and change the AndroidManifest.xml with your class as app name and entry point as described in the README below the .../hellotcltk folder.

MG Thanks for the quick reply. We removed a number of unneeded packages from assets/ and jni/ (removing jni/tiff/ resolved the issue mentioned before), and have a successful compile now. However, the app (included under assets/app) is throwing an error; the Tcl command
  glob -dir $imgPath -tails *.gif

is throwing the error "no files matched glob pattern "*.gif"". However, we've confirmed that the path is correct and the files exist. If we cd into the dir and do "glob *.gif" without the -dir, it works correctly. Adding the path (even as glob -dir . *.gif) errors the same way. Is there a known issue there?

chw 2015-01-14: confirmed the "glob" problem. Please file a ticket on http://www.androwish.org. Seems to be a deficiency of the ZIP virtual file system which needs fixing. Regarding the rebuild: which NDK version did you use?

MG Ticket filed. I'll have to check later which versions were installed, will post it here when I can. For the time being I've worked around the glob error by just cding into the dir first, and my app runs! (It's totally unusable until I get around to retheming it for tiny screens, but hey, it's a start;) Thanks for all the hard work, chw, and for sharing/supporting it freely.

MG It's sdk 24.0.2 and ndk r10d (x86). Btw, what's the best way to tell if you're running on Android programatically? So far I haven't found a value I can point at to say it's definitively Android and not some other *nix environment, and my best thought is to check for borg being available.

AM - 2015-03-31 17:35:36

I have some strange problems after the last upgrade. I have three programmes which I am using on my Android device, all three ran on the prior version, except that on one of them the display was corrupted when scrolling.

After the upgrade that programme now compiles and runs perfectly, but the other two compile and install with no errors, but do not run. After investigating using "adb logcat -d" the error seems to be

E/sqlite3_icu(29109): dlsym("u_strToLower"): Symbol not found: load_library(linker.cpp:745): library "/data/data/tk.tcl.address/files/../lib/libtclsqlite3.so" not found E/sqlite3_icu(29109): dlsym("u_errorName"): Symbol not found: load_library(linker.cpp:745): library "/data/data/tk.tcl.address/files/../lib/libtclsqlite3.so" not found

but that is as far as I can get. The sql database does not appear to be corrupt, it loads and displays using aSQLiteManager. Can anyone suggest what has gone wrong?

chw 2015-01-04: Starting with the release "Groundhog Day" the SQLite package is built with the ICU extension enabled. This means that on opening the very first database the system ICU library is dynamically linked to the process. From your "adb logcat" output this seems to go wrong. Now the question is: does your device have "/system/lib/libicuuc.so" and does this shared library export all required symbols? If you're on Linux and have Android SDK and optionally NDK installed you can try
    adb pull /system/lib/libicuuc.so .
    nm -D libicuuc.so | grep u_strToLower
    nm -D libicuuc.so | grep u_errorName

Second important question is the exact point in time when these "adb logcat" messages are written. Is it as consequence of a "package require sqlite3"?

I've tested dynamic loading of the ICU stuff on five devices and saw no problems. If it turns out that yours is the first failing I shall turn off SQLite's ICU support in the next release of AndroWish.

BTW: you can find out which libraries are loaded into a running AndroWish by evaluating
exec cat /proc/[pid]/maps

or
set f [open /proc/[pid]/maps r]
set maps [read $f]
close $f

Funny enough libicuuc.so is already loaded when I start a plain AndroWish without explicit "package require sqlite3" on my Lenovo Yoga tablet.

AM 2015-04-01: In answer to your first suggestion:
    $ adb pull /system/lib/libicuuc.so .
    151 KB/s (1029388 bytes in 6.654s)
    $ nm -D libicuuc.so | grep u_strToLower
    000a8d69 T u_strToLower_48
    $ nm -D libicuuc.so | grep u_errorName
    000b1bfd T u_errorName_48

Interestingly, all three programmes include "package require sqlite3" at the head of the code - remember that one runs correctly but the other two do not.
exec cat /proc/[pid]/maps | grep libicuuc

shows three result but I could not read what they were on my phone :-)

I am going to remove the explicit package require and see what happens. Update Removing the explicit package require removed the actual error message, but the programmes still did not run, unsurprisingly. Downgrading to Peter Pan meant they all ran correctly, so I am pretty certain you are correct in you assumption.

chw 2015-04-01: Hopefully the check-in http://www.androwish.org/index.html/info/c24bdd8c1506445b fixes your problem. The last two AndroWish releases resolve u_errorName_4_8 or similar for ICU < 4.9, the check-in extends this to try u_errorName_48 as fallback.

AM 2015-04-01: I will try it out.

AM 2015-04-29: Sorry to say that I just tried Don Quixote and there is no change to the error. The error is still shown:

E/sqlite3_icu(21337): dlsym("u_strToLower"): Symbol not found: load_library(linker.cpp:745): library "/data/data/tk.tcl.address/files/../lib/libtclsqlite3.so" not found E/sqlite3_icu(21337): dlsym("u_errorName"): Symbol not found: load_library(linker.cpp:745): library "/data/data/tk.tcl.address/files/../lib/libtclsqlite3.so" not found

chw 2015-04-29: I think it wouldn't be a bad idea if you would add a ticket with a snippet of "adb logcat" on http://www.androwish.org

PZ - 2015-04-23

I can't find anything about how to send&receive SMS under Androwish... Is there any chance?

chw 2015-04-23: how about combining "borg activity" with the information on https://developer.appcelerator.com/question/118375/sms-send-in-android

dzach 2015-11-17: For those who are lost (like me) in the java class hell, here is an example of how to do it:

Popup a form ready to send an sms from Tcl:
    proc sendSMS {tel msg} {
      ## popup a form for sending an SMS with the given data
      borg activity android.intent.action.VIEW $tel "vnd.android-dir/mms-sms" {} {} [list sms_body $msg]
    }
    sendSMS 1234567890 "this is a test SMS"

Receive:
    set cursor [borg content query content://sms/inbox]
    # initially, cursor points before first row
    while {[$cursor move 1]} {
        # puts one row per SMS message including sender's phone number and msg body text
        puts [$cursor getrow]
    }

But how do we send an SMS directly, without using the form manually?

chw 2015-11-18: a draft implementation of "borg sendsms" is available with check-in http://www.androwish.org/index.html/info/d7cacd9d731cdccd
    # proc to deal with broadcast intent
    proc bc {retcode action uri type categories arglist} { puts "$action -> $retcode" }
    # register callback for sent/delivered SMSes
    borg broadcast register SMS_SENT bc
    borg broadcast register SMS_DELIVERED bc
    # send something
    borg sendsms 01234567 "AndroWish sucks literally, utterly! It increases my phone bill and drains my battery!" SMS_SENT SMS_DELIVERED

For now it must be built from source and the SEND_SMS permission must be explicitly uncommented in AndroidManifest.xml.

dzach 2015-11-21: I receive a broadcast action on reception of an sms by using:
    borg register android.provider.Telephony.SMS_RECEIVED bc

where bc is a proc that deals with the broadcast intent, as above. Receiving SMSs was enabled by adding:
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_SMS" />

to the file AndroidManifest.xml, before re-compiling AndroWish. I'm not sure if they are both needed.

Now, the above broadcast action result is:
    -1 android.provider.Telephony.SMS_RECEIVED {} {} {} {format 3gpp pdus {[Ljava.lang.Object;@41a69fb0} subscription 0}

and the question: How can we get info on the specific sms that was just received, by using the unique PDU identifier [Ljava.lang.Object;@41a69fb0?

[dansic] - 2015-05-12 02:54:27

I wonder what change after "The Flintstones". This is the latest version that I am able to run on my tablet. All newer versions are giving me a black screen that last for a few seconds and then quit. Does later versions of Androwish require an Android version later than 4.2.1?

chw 2015-05-12: Too few information to have an idea what is wrong. What about if you try to get some "adb logcat" output for further analysis?

[dansic] - 2015-05-12 11:56:23

I must admit I don't know what you are talking about. What is adb? Maybe you can tell me what more I can do to get that adb trace you are talking about?

Be aware though, my background is not in programming. I am only a user of Tcl/Tk. I used it as tool in the course of my main job to access usb to serial devices or distant server over the socket command. When I fumble across Androwish i decided to give it a try. So in brief, what I was used to do was to download the APK file on my tablet, toggle the security switch to allow installation from unknown source and then starting the apk. After that I was only tapping the Androwish icon to run the thing.

chw 2015-05-12: Some pointers:

Following information might be helpful to analyze your problem:

  • Android OS version (AndroWish should run on Android >= 2.3 up to 5.1 on ARM and x86)
  • Amount of RAM of your device
  • Output of the command "adb logcat" collected just after AndroWish had crashed

[dansic] 2015-05-14

Sorry for the delay to answer. I am on a field trip right now and cannot really do the installation of all these softwares on the laptop I have at hand. I will be trying to do that next week when I will be back. Meanwhile here are some answers:

  • Android version is 4.2.1.
  • Memory 1GB
  • Running on Asus Infinity (tf700t) with the keyboard/docking station

Where should I post the output of logcat when I will get it? Is it OK to paste it onto this page?

chw 2015-05-15: A good place for a bug report is the ticket system on http://www.androwish.org

dzach 2015-10-24: Would it be possible to use zbar as a separate TCL package on a Linux machine, as is? I see the file tclzbar.c in the source code of Androwish and it seems to me like most, if not all, of the work is already done, though I have not gone into any depth with analyzing it. How is it linked to libzbar.so ? I've had difficaulties with compiling zbar in the past due to problems with dependencies, but libzbar.so itself is already installed by zbarcam or zbarimg from a distribution's repository.

chw 2015-10-24: Should be possible with the latest check-in http://www.androwish.org/index.html/info/c82e1d09884d0458. I've tested manually building it on a CentOS6 system with these commands:
    $ gcc -fPIC -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -DTCL_THREADS=1 -DPACKAGE=\"zbar\" -DPACKAGE_VERSION=\"0.10\" -c tclzbar.c
    $ gcc -shared -o libtclzbar.so tclzbar.o -lzbar -ltclstub8.5 -ltkstub8.5
    $ wish8.5
    % load ./libtclzbar.so Zbar

If you succeed in adding a Makefile.am or a TEA compliant configure infrastructure I'd be glad to merge it into the AndroWish source tree.

dzach 2015-10-25: Indeed, it compiled nicelly manually. I've created a separate page zbar with your instructions, in case someone else wants to build the package. Thank you chw!

dzach 2015-11-05: I'm trying to understand the logic behind the event firing sequence when using:
    sdltk touchtranslate 1

The code below was used to gather the sequence of events:
    proc setup {} {
        package req tkpath
        package req borg
        sdltk touchtranslate 1

        set ::events {}
        destroy .c
        pack [::tkp::canvas .c] -fill both -expand 1

        bind .c <Button-1> {lappend ::events [list %b %s <Button-1> [clock milli]]}
        bind .c <Button-2> {lappend ::events [list %b %s <Button-2> [clock milli]]}
        bind .c <Button-3> {lappend ::events [list %b %s <Button-3> [clock milli]]}

        bind .c <ButtonRelease-1> {lappend ::events [list %b %s <ButtonRelease-1> [clock milli]]}
        bind .c <ButtonRelease-2> {lappend ::events [list %b %s <ButtonRelease-2> [clock milli]]}
        bind .c <ButtonRelease-3> {lappend ::events [list %b %s <ButtonRelease-3> [clock milli]]}

    }
    proc calc ev {
        foreach e $ev {
                lassign $e b s evt clock
                if {![info exists t0]} {
                        set t0 $clock
                }
                puts [expr {$clock - $t0}]\t$b\t[format 0x%04x $s]\t$evt
        }
    }

To get the event sequence:
    $ setup
    (press a finger on the touchscreen, make a long dragging move, then lift finger}
    $ calc
    ms     btn  state     event                 comment
    --------------------------------------------------------------
    0      1    0x0000    <Button-1>            # Finger down
    912    1    0x0100    <ButtonRelease-1>     # Auto release B1
    913    3    0x0000    <Button-3>            # Auto fired B3
    2094   1    0x0400    <Button-1>            # Finger start moving, auto fired B1
    2094   3    0x0500    <ButtonRelease-3>     # Auto fired B3
    4458   1    0x0100    <ButtonRelease-1>     # Finger lifts off screen

Without the move, the sequence is:
    ms     btn  state     event                 comment
    --------------------------------------------------------------
    0      1    0x0000    <Button-1>
    909    1    0x0100    <ButtonRelease-1>
    909    3    0x0000    <Button-3>
    3632   3    0x0400    <ButtonRelease-3>

I would expect a sequence of events more like the following:
    ms     btn  state     event                 comment
    --------------------------------------------------------------
    0      1    0x0000    <Button-1>            # Finger down
    913    3    0x0000    <Button-3             # Auto fire B3
    4458   3    0x0500    <ButtonRelease-3>     # Finger lifts off screen. Auto fired B3
    4458   1    0x0100    <ButtonRelease-1>     # Auto fire B1

The way it stands now alters the expected funtionality of B1 events, by having it auto-release after ~ 1s. That could be a problem e.g. during canvas panning, where B1 may be pressed for longer than 1s periods. I think there no way now to prevent <ButtonRelease-1> from firing by using [return -code break] inside <Button-3>'s bind scripts, as one could do if the B3 events where timewise nested inside B1 events.

chw 2015-11-05: Not clear what your problem is or your intentions are. It gets even more complicated when fast wipes are part of the event stream: they translate to <B2>/<B2-Motion>/<ButtonRelease-2> when sdltk touchtranslate has the LSBit on. If you can live without right/middle mouse button emulation trickery, simply turn the corresponding touch translation bit off. OTOH, did you check out the canvas item demo page in androwish:///assets/sdl2tk8.6/demos/widget ? It's quite responsive and can discriminate both item moves and drag scroll.

dzach 2015-11-06: Hey chw, monumental and fascinating work! Kudos and thank you for revitalizing TCL in such a wonderful way! I'm a rather late comer in Androwish, partly because Samsung has made some of their devices children of a lesser god, but nonetheless it's never too late to join in. To the point:

Fast wipes work as expected, there is no complication and no unexpected firing of other events. I am adapting my existing code for generating Button-3 events by long press/release of Button-1, which works for me the way I described above, i.e. auto-generated Button-3 events are nested time-wise in Button-1 events in a cause and effect manner. I wouldn't want to give up middle/right button events cause they compensate for the lack of space on a phone's screen. I'm just trying to see the logic behind <Button-1> releasing without the finger been lifted from the screen, and then firing again when the move starts. I understand that this behavior can be turned off by changing bits in the touchtranslate mask, and in any case, one can still generate Button-3 events in his own code, but I'd be interested to understand why things are designed in a different way.

chw 2015-11-06: I see. Trying to remember the logic of the touch to mouse event code (it's a complicated weird piece you can review in http://www.androwish.org/index.html/artifact/6589a0e7e32d53a8cb45afdcb6c0dd1cca969df0?txt=1&ln=538-2345). I think I followed my observations on Windows 7 Tablet Edition regarding the behaviour of long holding one finger without movement. It seemed essential to have a pure button 3 press for popup menus, i.e. button 1 has to be released before. In your first trace above the order of the ButtonRelease events is debatable but I've never saw any problems caused by it. Things get even more complex due to interaction with the Tk_UpdatePointer() function in http://www.androwish.org/index.html/artifact/2b9b831bb990bb0090eee73a8eccae2fdd5c965f?txt=1&ln=215-424 which can generate additional ButtonRelease events on detection of state changes. If you really observe problems I need simple code snippets with reliable reproducability.

dzach 2015-11-23: My apologies for this long post. I had a look in the code you marked in the jni/sdl2tk/sdl/SdlTkInt.c file above, but its not easy to find my way around to produce a useful patch. So here is a code snippet of what I'm trying to accomplish, i.e. a simulated two button mouse:

First the straight forward case with two different hardware buttons. The same behavior is expected both with a vanilla wish and witn AndroWish and translated buttons:
 proc test1 {} {
   ## double action button demo

   package require tkpath
   destroy .c
   pack [tkp::canvas .c -background white] -fill both -expand 1
   .c create prect 0 0 40 40 -tags btn -fill red

   .c bind btn <Button-1> {
      %W itemconfig btn -fill blue
   }
   .c bind btn <ButtonRelease-1> {
      puts "Action-1"
      %W itemconfig btn -fill red
   }
   .c bind btn <Button-3> {
      %W configure -background black
   }
   .c bind btn <ButtonRelease-3> {
      puts "Action-2"
      %W configure -background white
   }
 }

On a PC (vanilla wish):
 # Clicking Button-1 produces Action-1 (on button release).
 # Button-1 press is indicated by the change of color on the button face from red to blue.

 # Repeatedly pressing Button-1 produces:
 Action-1
 Action-1
 Action-1
 # while repeatedly pressing Button-3 produces:
 Action-2
 Action-2
 Action-2
 # as expected

On an Android running AndroWish:
 # Repeatedly pressing Button-1 produces:
 Action-1
 Action-1
 Action-1
 # as expected, but ...
 # repeatedly long pressing Button-1 (translated to Button-3) produces:
 Action-1
 Action-2
 Action-1
 Action-2
 Action-1
 Action-2
 # which is not expected

I hope the above demonstrate the problem I mentioned earlier. I cannot find a way to prevent Button-1 from firing while I wait for a translated Button-3 event, unless I resort to using a timer that ends earlier than the one translating to Button-3 events. So, practically, there is no way to have both Action-1 and Action-2 programmed on the same button, or Button-1 and Button-3 working at the same time. Here is a simulated Button-3 solution that I use, based on long press of Button-1, but without the use (and other benefits) of sdltk touchtranslate 1:

Simulated Button-3 operation (no sdltk touchtranslate 1 translation):
 sdltk touchtranslate 0

 proc test2 {} {
  ## double action button demo

   package require tkpath
   destroy .c
   pack [tkp::canvas .c -background white] -fill both -expand 1
   .c create prect 0 0 40 40 -tags btn -fill red

   .c bind btn <Button-1> {
      %W itemconfig btn -fill blue
      set ::timer [after 900 {
         event generate %W <Button-3>
      }]
   }
   .c bind btn <ButtonRelease-1> {
      %W itemconfig btn -fill red
      if {![llength $::timer]} {
         event generate %W <ButtonRelease-3>
         break
      }
      puts "Action-1"
      after cancel $::timer
      set ::timer {}
   }
   .c bind btn <Button-3> {
      %W configure -background black
      set ::timer {}
   }
   .c bind btn <ButtonRelease-3> {
      puts "Action-2"
      %W configure -background white
   }
 }
 # Clicking Button-3 (long press) produces Action-2 (on button release).
 # Button-3 press is indicated by the change of color of the background from white to black.

 # Repeatedly pressing Button-1 produces:
 Action-1
 Action-1
 Action-1
 # while repeatedly long pressing Button-1 (simulated Button-3) produces:
 Action-2
 Action-2
 Action-2
 # as expected

dzach 2015-11-06: Thank you for the quick response. Your description above explains what I am observing. Generally, the way I see it, it is easy to generate any kind of event, if one knows the sequence of the real/physical events that drives the process. The opposite is not always possible. So I try to preseve this physical sequence of events unalterred. Regarding popup menus, I have them popup on firing of auto-generated (timer based, long) <Button-3> press events. <ButtonRelease-3> happens in a similar manner, initiated by <ButtonRelease-1>, but the popup depends only on (delayed) button press, not on button release. Touching empty space, i.e. another <Button-1> press, releases the popups. Of course, application specific code can change this and have <ButtonRelease-1> fire whenever necessary. Regarding the tests above, I've performed them on two android devices running Andoid v.4.4.2, and I always got the same sequence, with different timings of cource, depending on when the physical actions occured. Maybe there are other conditions that influence these results, if I am interpreting you correctly, saying "the trace is debatable". Has the code above given you different results? I've removed <Button1-Motion> events for clarity, but one can include them if necessary, so that start/stop of motion is observable.

The question "what happens when in the middle of a button press we have a state change" is interesting. If my observations with desktop Tk are correct, state changes (that are reported by parameter %s in a bind script} in keyboard <Shift> <Ctrl> and <Alt> and maybe others, are not reported separately; they are reported together with a 'regular' key press or a mouse button press or move. Changes in button state are indeed reported as they happen physically, e.g. if one presses <Button-1> and then, while keeping <Button-1> pressed, presses <Button-3> and releases it, so do the events report; their physical sequence is preserved. That's where I noticed the difference in the way Androwish was generating mouse events.

dzach 2015-11-07: Is there a way to turn on bluetooth programmatically? Could something like:
    borg activity BluetoothAdapter.ACTION_REQUEST_ENABLE {} {} {} {} {} callback

be used for this and how?

chw 2015-11-08: Yes, you can. Use
    borg activity android.bluetooth.adapter.action.REQUEST_ENABLE {} {} {} {} {} callback

which pops up a system dialog when Bluetooth is turned off. If it is already on, the dialog is not shown. Unfortunately, the reverse operation (turning Bluetooth off) is not available in http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html

dzach 2015-11-08: Thanks chw for both the above and the new borg bluetooth on|off subcommand. I now see that the little print in the doc I had unknowingly overlooked:
    Constant Value: "android.bluetooth.adapter.action.REQUEST_ENABLE"

is what is needed to get some of these things going.

dzach 2015-11-09: Is there an example of how to get a click event from a notification?
    borg notification add 5 "A notification" "and some details" {} ;# ?action uri type categories component arguments? <-- what kind of activity can be given here to get a click event?

chw 2015-11-09: "borg notification" is similar to "borg alarm" w.r.t. handling the special component name "self". Thus you might want to try:
    proc intent_handler {action uri type cat args} {
        if {$action eq "androwish-notification"} {
            catch {borg notification delete $uri}
        }
        borg beep
    }
    borg onintent intent_handler
    borg notification add 99 "Title" "Notification 99" {} androwish-notification 99 {} {} self
    borg notification add 11 "Title" "Notification 11" {} androwish-notification 11 {} {} self

dzach 2015-11-09: It feels like Santa Clause came earlier this year. Thanks!

dzach 2015-11-09: The soft keyboard, that pops up on the screen, has different dimensions depending on the device, screen orientation and maybe other parameters. Is there a way to know what its height is, on each occasion?

chw 2015-12-26: Maybe possible by enhancing the Java activity code but depending on Android version, type of on screen keyboard etc. OTOH the non-keyboard area is panned according to the position of the text input rectangle which in turn is (should be) adjusted to the cursor position by Tcl binding code. What would be the benefit of knowing the dimension when you still have to provide the approximate root window coordinate of the text input position?

dzach 2015-12-26: Season's greetings and thank you for this marvelous software-present chw! Couldn't avoid a last question for this year though :) Is there a way to have AndroWishSDK updated with every update of the fossil trunk, instead of waiting for its next formal release? That would make it easier to create apks that use the most recent version of the AndroWish code.

chw 2015-12-26: An interesting idea, although: it would require to have the prebuilt stuff (native shared libraries, compiled Java classes) in fossil, too. I think this must be organized either in a special branch or (better) in a separate fossil repository. Alternatively, the bones tool could additionally control a full build (including Android NDK for native code) from the fossil source code. Surely this needs much more thoughts (in 2016 and beyond :-).

EMJ - 2016-08-13 17:18:41

Is there a way to get AndroWish to write to an external SD? Thanks.

Jorge - 2016-12-10 22:21:57

when executing usbserial command, it returns an empty string, any idea why? (I had an arduino connected throuh USB-OTG adapter)

Jorge - 2017-09-07 14:51:59

for the issue above (usbserial), the problem was the specific tablet, when trying with a different device, usbserial worked just fine

Jorge - 2017-09-07 14:53:23

How can I launch the included examples (on the VFS assets folder) from the Androwish console?

[teknokrat] - 2018-01-14 11:57:00

I've just installed yesterday, and now when I run it, the screen stares black. After flipping around vertically, it appears. So it must catch the event of 'being present' again and redraw itself. The tablet is a huawei EMUI 3.0 T1-A21w

I think the project is outstanding, but it needs to address basic redraw of the app, and then an easy to browse doc.