Page 46 of 60 FirstFirst ... 36444546474856 ... LastLast
Results 451 to 460 of 591

Thread: Native Android control client

  1. #451
    Join Date
    May 2005
    Posts
    109

    Default

    Hello.
    A new user here. I have used Netremote for several years now, but my devices are starting to break down one after one so I decided to try to use my phone as a remote instead. I found this project and decided to give it a try. It looks really impressive.

    I'm still just experimenting and right now I'm trying to synchronize variables with Eventghost, so far I have managed to change states of the variables from Andre and getting the new value in the response. The problem is to get the variable to reflect in Andre when it is changed by some other event than a button press in Andre, like for example if a program is activated on the HTPC. I have read about the cloud-messages but I would like to use something that doesn't need a Internet connection, just the local network. Is there any other way?

    Also I would like to update some variables when Andre starts (or rather when it goes from sleep, like androids onResume), is it possible to call a button when Andre goes from sleep to get the latest values for some variables?

    I'm sorry if I ask questions that already has been answered, but I have realized that the documentation is quite outdated and 45 pages on this forum is a lot to read through.
    Thanks

  2. #452
    Join Date
    Mar 2007
    Posts
    277

    Default

    Quote Originally Posted by pgpg View Post
    I'm still just experimenting and right now I'm trying to synchronize variables with Eventghost, so far I have managed to change states of the variables from Andre and getting the new value in the response. The problem is to get the variable to reflect in Andre when it is changed by some other event than a button press in Andre, like for example if a program is activated on the HTPC. I have read about the cloud-messages but I would like to use something that doesn't need a Internet connection, just the local network. Is there any other way?

    Also I would like to update some variables when Andre starts (or rather when it goes from sleep, like androids onResume), is it possible to call a button when Andre goes from sleep to get the latest values for some variables?
    Hi, thanks for giving Andre a try!

    Right now there's no easy way to push data to Andre outside of the cloud-to-device stuff. Instead there's a feature that might suit both of your questions. In the XML, as part of the <Settings> tag, you can have <ButtonTriggerOnStart> and <ButtonTriggerOnResume> which call a Button when the app first launches and whenever the app resumes respectively, either from sleep or from another app (pretty much tied directly into Android's onResume call actually).

    For your first question, what I've done personally for synching/updating state in Andre when something exclusively server-side happens is to query the server state in an onResume call and update Andre.

    For example, assume another remote (or directly on the HTPC) you've started VLC and want Andre to know it's running and automatically switch the interface to reflect that it's the currently active media player by changing what the buttons say or do. In the ButtonTriggerOnResume you call a Button which makes a web-service request to Girder that fetches the known state, such as current foreground media player, and update your interface as a result.

    Over LAN, apart from any wifi reconnection delays the Android device may encounter, you'd turn the device on and within a second or two this method would query and update state appropriately. I use this to detect, via WiFi access point proximity, what part of the house I'm operating from and automatically switch the control calls (changing the 'Location' parameter in Andre).

    You can also use intents for triggering buttons and setting variables, so anything like external that might be listening to your setup in some way (Tasker, EventGhost, etc.) that has the ability to trigger Android intents can cause actions to happen inside Andre, even if the phone is sleeping or another app has focus.

    Finally if you really want to update the state directly from Andre when it's sleeping so it's already set to go when you power it on, you could set up a repeating Timer in the config to poll this state every so often, but you'll be causing increased battery drain as a result.

    I've shied away from making an Andre-specific client/server communication channel because dedicated polling/listening can be difficult to make reliable and efficient, and I've focused a lot on long battery life so as a remote your average device can go for days/weeks without recharging. There is a good likelyhood that I'll look into having a back-channel communication method down the road, but it will probably be a little while, since I've got a lot of documentation and example stuff to finish so I can get the first market release ready.

    Please feel free to ask any questions or raise any issues or suggestions you may have, I know the docs are pretty much uselss right now and plowing through months of posts is not very effective, particuarly since a lot of stuff evolves and changes throughout the course of this thread.

  3. #453
    Join Date
    May 2005
    Posts
    109

    Default

    Thank you for answering

    Quote Originally Posted by HTLuke View Post
    Right now there's no easy way to push data to Andre outside of the cloud-to-device stuff. Instead there's a feature that might suit both of your questions. In the XML, as part of the <Settings> tag, you can have <ButtonTriggerOnStart> and <ButtonTriggerOnResume> which call a Button when the app first launches and whenever the app resumes respectively, either from sleep or from another app (pretty much tied directly into Android's onResume call actually).
    <ButtonTriggerOnResume> sounds like the feature I was looking for. Unfortunately I didn't get it to work. I put "<ButtonTriggerOnResume>btn_onResume</ButtonTriggerOnResume>" inside the <Settings> tag. btn_onResume is the id of the button I wanted to call, is that how it is intended to be used?

    Also I am having some problems with getting the values from the response, I use a script similar to the one in "config_2way_ex1.xml". But it seems that the value in resultString always is the value from the previous call. So in the first call it is always null. The second call it is the value that is was suppose to have in the first call, and so on.

    Quote Originally Posted by HTLuke View Post
    For your first question, what I've done personally for synching/updating state in Andre when something exclusively server-side happens is to query the server state in an onResume call and update Andre.

    For example, assume another remote (or directly on the HTPC) you've started VLC and want Andre to know it's running and automatically switch the interface to reflect that it's the currently active media player by changing what the buttons say or do. In the ButtonTriggerOnResume you call a Button which makes a web-service request to Girder that fetches the known state, such as current foreground media player, and update your interface as a result.

    Over LAN, apart from any wifi reconnection delays the Android device may encounter, you'd turn the device on and within a second or two this method would query and update state appropriately. I use this to detect, via WiFi access point proximity, what part of the house I'm operating from and automatically switch the control calls (changing the 'Location' parameter in Andre).
    It is a similar functionality I want. If I select a movie in my HTPC software and it is started in another media player, then I want the remote to automatically change page. It seems a bit of a hassle to turn the device on and off every time I start a movie. Also I don't like polling for the value, seems like a lot of overhead.

    Maybe a combination of different techniques could be used. The state of the variables could be fetched in ButtonTriggerOnResume. Also when Andre is active it could start listening for UDP broadcasts on a port and get variable changes that way. Then in onPause the UDP socket is closed. That way the socket is only open while the screen is on and it shouldn't effect battery life. When a UDP packet is received it could trigger a button or a script.

    Quote Originally Posted by HTLuke View Post
    Please feel free to ask any questions or raise any issues or suggestions you may have, I know the docs are pretty much uselss right now and plowing through months of posts is not very effective, particuarly since a lot of stuff evolves and changes throughout the course of this thread.
    I have a few suggestions for new features, maybe some already are implemented and I just don't know about them.

    * Multitouch flings, like fling down with one finger to trigger a button, fling down with two fingers to trigger another button.
    * Send UDP packets from buttons, useful for sending commands to a network connected IR-transmitter.

    Andre is a very impressive application. I am just suggesting features that would fit my needs even better. Keep up the good work

  4. #454
    Join Date
    Mar 2007
    Posts
    277

    Default

    Quote Originally Posted by pgpg View Post
    <ButtonTriggerOnResume> sounds like the feature I was looking for. Unfortunately I didn't get it to work. I put "<ButtonTriggerOnResume>btn_onResume</ButtonTriggerOnResume>" inside the <Settings> tag.
    Sorry, I realized late last night that I should have given you a better example, there's a specific format for it. You need at the minimum to identify the pageId and the buttonId (Button IDs are unique only to each page) separated with a pipe character, like this:

    Code:
    <ButtonTriggerOnResume>pg_myPage|btn_onResume</ButtonTriggerOnResume>
    You can also optionally add Action (display, touch, heldstart, heldrepeat, or release), localeId ('default' or any others you've defined in <Locales>), state ('default' or any state you've defined in that Button), suppressAnims (true or false), blend-state (true or false), suppress Control Parameters (true or false) and suppress Display Parameters (true or false) in that order separated with pipes, like so:

    Code:
    <ButtonTriggerOnResume>pg_myPage|btn_onResume|touch|default|default|true|true|false|true</ButtonTriggerOnResume>
    Here's a brief explanation of each field above:

    PageId - ID given to the page on which your Button resides
    ButtonId - ID given to the Button you wish to trigger
    Action - One of the five possible Button Actions (display, touch, heldstart, heldrepeat, release)
    LocaleId - If you've defined multiple Locales and have Button functionality that changes based on Locale, you can trigger that specific functionality
    State - If you've defined multiple states for the Button and want to trigger a specific State
    SuppressAnims - If there are any animations associated with this Button that would normally play for this Button/Action, do not run them during this trigger
    BlendState - If you have more than the default (implied) state and are triggering that state here, whether or not this Button trigger merges the non-default state Parameters with default (so you don't have to duplicate the common Parameters between States)
    SuppressControlParams - Do not trigger any 'Control' functionality with this trigger (anything that doesn't change the Button's look and feel is a Control Parameter)
    SuppressDisplayParams - Do not trigger any 'Display' functionality for this Button with this trigger (imageUrl, label changes, etc. are all Display Parameters) this is useful to get the functionality of a Button without having it actually look 'pressed' in your UI

    Button Triggers are used fairly extensively throughout Andre (when you change to a new Page, when you chain one Button press into others, when defining Intents from other apps, etc.) and this format is used universally for them.

    Quote Originally Posted by pgpg View Post
    Also I am having some problems with getting the values from the response, I use a script similar to the one in "config_2way_ex1.xml". But it seems that the value in resultString always is the value from the previous call. So in the first call it is always null. The second call it is the value that is was suppose to have in the first call, and so on.
    This is because the web service calls are by default asynchronous. You must either handle variable changes asynchronously (you can register your variable to trigger a Button whenever it changes), or you can add a Parameter to the Button to make the web service call run synchronously, something like:

    Code:
    <Parameter name="serviceDomain">192.168.1.1</Parameter>
    <Parameter name="servicePort">80</Parameter>
    <Parameter name="serviceApi">/ajax_sendevent.lhtml</Parameter>
    <Parameter name="serviceRunSync">true</Parameter>
    <Parameter name="serviceResultVar">girderResponse</Parameter>
    <Parameter name="serviceParams">device=4001,event=MENU</Parameter>
    <Parameter name="toastText">_%girderResponse%_</Parameter>
    This should hit 192.168.1.1:80/ajax_sendevent.lhtml?device=4001&event=MENU, wait for the response to be posted and store it into a variable called girderResponse, then continue with execution and display the contents to the screen via the Toast notification.

    One thing to keep in mind is Parameters must be in order of execution; since the Parameter 'serviceParams' effectively triggers the web service call, make sure to have your other service-call preparation Parameters called before it, and any variable handling Parameters after.

    This is the easiest way to handle web service call results, but it blocks the UI while it happens. Most of the time on a LAN you'll never notice, it should happen within milliseconds. But for anything that may take the server time to reply (or if you're controlling over 3G or something) you'll probably want to handle the change asynchronously. To do that, pre-define the variable at the top of the XML in the <Variables> section like so:

    Code:
    <Variables>
       <Variable id="girderResponse" buttonTriggerOnUpdate="pg_myPage|btn_onResumeResult"/>
    </Variables>
    Of course be careful to separate the before-call and after-call logic into different Buttons so you don't put yourself into a loop. With this pattern you can actually have multiple calls queued/running at the same time, do processing on the result if you need to (i.e. Girder responses always have a linefeed on them, so I pass them through a small JavaScript snippet after receiving them to trim it), etc.

    Quote Originally Posted by pgpg View Post
    It is a similar functionality I want. If I select a movie in my HTPC software and it is started in another media player, then I want the remote to automatically change page. It seems a bit of a hassle to turn the device on and off every time I start a movie. Also I don't like polling for the value, seems like a lot of overhead.

    Maybe a combination of different techniques could be used. The state of the variables could be fetched in ButtonTriggerOnResume. Also when Andre is active it could start listening for UDP broadcasts on a port and get variable changes that way. Then in onPause the UDP socket is closed. That way the socket is only open while the screen is on and it shouldn't effect battery life. When a UDP packet is received it could trigger a button or a script.
    That is an interesting approach, let me give it some thought. One question though; how frequently/for how long do you have the screen on, and how likely is it during that time that you'd get an update on the server that you'd wish to intercept? Going by my own usage patterns, unless I'm simultaneously using the device for other apps (web or whatnot), my device sleeps within 30 seconds and the likelyhood that I'd turn it on (getting an update via OnResume check), use it to change something, but get an interesting server-side event before I put it down and the screen turns off is tiny.

    I'd love to hear more about your use case here so I can best implement the feature(s) to make it work for you. In my case, even if I'm using the Web or some other App in between, as soon as I flip back to Andre the OnResume call happens and it would update. So the only situation that I can think of that would apply is if I turned on the device, had Andre running as the foreground app and left it there and had the screen timeout to something really high (which is a perfectly possible use-case if you've got it perma-plugged in).

    Still, you're not the first to desire an Andre listener service and I'm happy to oblige where there's a common need, so I will bump it up on the priority list to look into again.


    Quote Originally Posted by pgpg View Post
    I have a few suggestions for new features, maybe some already are implemented and I just don't know about them.
    * Multitouch flings, like fling down with one finger to trigger a button, fling down with two fingers to trigger another button.
    * Send UDP packets from buttons, useful for sending commands to a network connected IR-transmitter.
    I've been considering multi-touch for awhile, and it is also something a few others have asked for. My only obstacle to implementation over the existing support for single-touch flings is I've been subbornly targeting 2.1 as a functional OS minimum, and the multi-touch code for 2.1 is a bit ugly, particularly when combined with some of the convoluted touch event handling I do for other things. I've got a to-do for 3.0-ish (probably 6ish months from now I'd guess) to re-write all the touch handling to consolidate, and make the decision on either ditching 2.1 support, or forking the functionality so 2.1 can live in harmony with 2.3+ support. I used to have full, arbitrary gesture support where you can define on the fly any gesture you wanted. I'd probably put that back in and let the user define multi-touch, swirls, etc. as they desire.

    As for IP transmission including TCP and UDP, it is very, very high on my current to-do list. I have several IP/non-http controllable devices that I'd like to use with Andre myself, so there's some selfish motivation too. I was about to release Andre 2.0 to the Market and get working on IP support immediately after, but I decided last-minute that I needed to make the layout/functionality editable on the device directly (no XML required) and it turned into a LOT of work. I'm marching through that stuff as quickly as possible while simultaneously compiling a new manual and a host of example configs, but I'm guessing it'll be another couple of weeks at best before I can turn my attention back to IP support.

    Quote Originally Posted by pgpg View Post
    Andre is a very impressive application. I am just suggesting features that would fit my needs even better. Keep up the good work
    Thanks for the kind words, I'm a big believer in a broad, flexible feature set, and I welcome any and all suggestions and comments, and try to implement everything I can reasonably do.

  5. #455
    Join Date
    May 2005
    Posts
    109

    Default

    Quote Originally Posted by HTLuke View Post
    You need at the minimum to identify the pageId and the buttonId (Button IDs are unique only to each page) separated with a pipe character, like this:

    Code:
    <ButtonTriggerOnResume>pg_myPage|btn_onResume</ButtonTriggerOnResume>
    Thank you for the explanation, it's working great. I update my variables on both start and resume now. One thing I noticed is that if my HTPC is turned off I get a dialog telling me that "Communication Failed" when I start Andre, and I have to wait for it to close. That behavior will make it quite cumbersome to start Andre and for example make a WOL call to turn the HTPC on.

    Quote Originally Posted by HTLuke View Post
    That is an interesting approach, let me give it some thought. One question though; how frequently/for how long do you have the screen on, and how likely is it during that time that you'd get an update on the server that you'd wish to intercept? Going by my own usage patterns, unless I'm simultaneously using the device for other apps (web or whatnot), my device sleeps within 30 seconds and the likelyhood that I'd turn it on (getting an update via OnResume check), use it to change something, but get an interesting server-side event before I put it down and the screen turns off is tiny.

    I'd love to hear more about your use case here so I can best implement the feature(s) to make it work for you. In my case, even if I'm using the Web or some other App in between, as soon as I flip back to Andre the OnResume call happens and it would update. So the only situation that I can think of that would apply is if I turned on the device, had Andre running as the foreground app and left it there and had the screen timeout to something really high (which is a perfectly possible use-case if you've got it perma-plugged in).
    I will have to get an update every time I start a movie because I don't play my movies in my HTPC frontend. I select a movie, the HTPC starts it in my media player, the HTPC then detects that the media player has been started and needs to send an update to Andre to tell it to change page. I can't get this information in the call response because the select button is used for other things than starting movies. Sure I could change page manually, but fewer clicks is better.

    When I use Netremote I have the screen on all the time, but the backlight turns off after a while. That way I can just touch the screen to start using the remote again. Also I can just press a hard button to pause the current movie without turning the pocket pc on. I don't know if this behavior is possible in Android, it would be nice to just touch the screen to turn it on again. Maybe it might be possible if the device uses an OLED screen, then the screen might go dark if some kind of black screen saver is used? I don't think it's possible to turn the backlight off and still listening for touch on an LCD screen?
    Regarding battery life, I'm content if the battery lasts 6 hours when I'm using it while watching movies.

    I have started to build a layout and have found some quirks. It's a high possibility for user error though.

    When Andre is running in the foreground the screen lock isn't activated when I turn the device back on after sleep. This is good, however if Andre isn't the foreground activity I would expect the screen lock to be activated. This isn't the case.

    When defining serviceParams I have to write something like "event=down" for it to send, I would like to be able to send just "down" (so it will be "page.html?down"). Not a big thing, but it will look better in Eventghost.

    I didn't get bgColor to work for ButtonGroup.

    After a fling the button that is called stays pressed (still has the tint-color), if another fling starts on a button that is still pressed, both the fling target button and the button that the fling started on is called.

  6. #456
    Join Date
    Mar 2007
    Posts
    277

    Default

    Quote Originally Posted by pgpg View Post
    One thing I noticed is that if my HTPC is turned off I get a dialog telling me that "Communication Failed" when I start Andre, and I have to wait for it to close. That behavior will make it quite cumbersome to start Andre and for example make a WOL call to turn the HTPC on.
    Indeed, there are some problems to address in the flow when it comes to communication issues such as the server being powered down. First, the current WOL Parameter doesn't yet go through the (Android device) WiFi connection test that web service calls do. This has been a long-standing bug which I somehow keep avoiding. This causes problems when you wake up Andre and it takes a few seconds to re-discover WiFi and the WOL Packet gets sent into the void without any feedback. (if you keep WiFi turned on and connected even when sleeping, this isn't an issue).

    I'll be fixing this soon so WOL will make sure to test WiFi and attempt to reconnect to it before broadcasting. (Incidentally one reason I've not fixed this yet is WOL is a UDP packet and I intended to revamp the TCP/UDP communication and WOL would get fixed along with this).

    There is also a testCommunication Parmeter (<Parameter name="testConnection">ipAddress|varName[|timeout]</Parameter>) which you can use to see if you can reach your server, and if not, send the WOL packet out. Also you can adjust web service call timeouts (<Parameter name="serviceTimeout">timeoutMillis</Parameter>) to reduce the pop-up window that tells you communication failed.

    What really needs to be added (on the to-do list already) is be able to define an error handling buttonTrigger when a web-service call fails for some reason. This way you could just tell it on error to send the WOL packet and pop up your own message to say something like "Please wait 60 seconds, the server is being started".


    Quote Originally Posted by pgpg View Post
    I will have to get an update every time I start a movie because I don't play my movies in my HTPC frontend. I select a movie, the HTPC starts it in my media player, the HTPC then detects that the media player has been started and needs to send an update to Andre to tell it to change page. I can't get this information in the call response because the select button is used for other things than starting movies. Sure I could change page manually, but fewer clicks is better.
    Ok, I'm not sure I understand the details of this, but I think I see where you're need arises from. I'll definitely bump the server listener provider up on the list. My first pass at it probably won't be the most efficient but it should get the job done and I'll refine it from there.

    One question on the above implementation though; instead of posting the update directly to Andre in the way you describe, could you not send the update to Girder and store it there in a custom variable that Andre could then fetch? If the current active/desired state for the remotes were always represented in a custom variable(s) in Girder as the source of truth, then Andre (or any other FE) could sync to that data instead of needing to sync with each back-end component realtime.

    Not that I'm suggesting re-arranging everything you've already got working, I'm just mostly curious to understand the various obstacles and implementations people encounter with their home automation so I can better provide the features people need.

    Quote Originally Posted by pgpg View Post
    When I use Netremote I have the screen on all the time, but the backlight turns off after a while. That way I can just touch the screen to start using the remote again. Also I can just press a hard button to pause the current movie without turning the pocket pc on. I don't know if this behavior is possible in Android, it would be nice to just touch the screen to turn it on again. Maybe it might be possible if the device uses an OLED screen, then the screen might go dark if some kind of black screen saver is used? I don't think it's possible to turn the backlight off and still listening for touch on an LCD screen?
    Regarding battery life, I'm content if the battery lasts 6 hours when I'm using it while watching movies.
    If you assign a hardButton to a Button you can have it trigger that functionality even when the screen is initially off, however right now Android turns on the screen when you do so. I'll look into having an option that controls whether or not the hardButton activates the screen (if possible). As far as the touchscreen activation goes, I'd love this myself and looked into it briefly, however without specific custom ROMs it isn't possible, Android doesn't normally allow this. You could fake it like you say with a black screen saver (you could set a Timer to switch to a page in Andre with nothing but one screen-sized black button for example) but even black screen will be lit up a bit, at least on traditional LCD screens.

    Quote Originally Posted by pgpg View Post
    I have started to build a layout and have found some quirks. It's a high possibility for user error though.
    There is a fair bit of complexity for anything but the most trivial layouts and it's easy to make one tiny typo that makes everything go weird. However there's also still plenty of weird behavior that doesn't initially seem to make sense, and I'm absolutely sure there's plenty of bugs left, so if you run into anything that is confusing or hard to resolve, don't hesitate to let me know and I'll gladly check it out and help you fix it.

    This is one of the biggest reasons I'm trying to make an all-graphical layout editor on the device. With all the features right there in menus and drop-down spinners, it'll be much easier to visualize what you're trying to do and play with it without worrying about syntax and formatting of XML. Advanced users may still wish to tweak stuff in the XML from time to time (which will still be perfectly doable), but when wanting to just get your groups and alignment right without having to continuously re-import the XML, Edit Mode will be a godsend.

    I'm about to post a new version that mostly is for pushing the beta date back again, but it has a good chunk of on-device editing features working, I'd love to get some feedback on it. There's a new Menu->More... item called 'Edit Mode' which will enable this. Pressing Menu again will let you exit and save or revert your changes. You can change all common settings for Entities right now (grouping, size, positioning/alignment, background/border, display animation, etc.) and a few entities have their entity-specifc tab populated (Text, Browser & ButtonGroup entities) but I've still got work to do on the rest (and there are lots of quirks and bugs remaining too).

    Speaking of the new version, the old version will expire on the 15th. Either update to the version I'm about to post before then, or go into Menu->Settings->Tools and select Export Settings. This will back up your preference/configuration details (server IP, port, display settings, etc.) so you can simply import them again instead of having to re-enter them from scratch.

    Quote Originally Posted by pgpg View Post
    When Andre is running in the foreground the screen lock isn't activated when I turn the device back on after sleep. This is good, however if Andre isn't the foreground activity I would expect the screen lock to be activated. This isn't the case.
    Can you give me the version of Android you're using and whether it's a custom ROM or not? Normally it should re-enable the lock screen if Andre isn't the foreground app, but I've seen some versions/ROMs which behave differently than the version I'm developing on and testing with. I'd like to figure out why and try to fix it.

    Quote Originally Posted by pgpg View Post
    When defining serviceParams I have to write something like "event=down" for it to send, I would like to be able to send just "down" (so it will be "page.html?down"). Not a big thing, but it will look better in Eventghost.
    Well you could try setting it like "<Parameter name="serviceParams">down=</Parameter> but you still may end up with an equal sign on the end resulting URL (probably something like "page.html?down="). The URL query parameters get built up by the URL object, I just feed it the name/value pairs that I parse from the serviceParams string. The query portion of a URL is technically supposed to have both a name and a value at all times, even if the value is actually empty/null, so the equals sign will probably always get put there by the URI builder.

    Quote Originally Posted by pgpg View Post
    I didn't get bgColor to work for ButtonGroup.
    I moved all background/border capabilities into the common Entity superclass so all entities can have borders and backgrounds. The attribute names have changed as a result:

    bgFillColor (eight character hexidecimal color AARRGGBB)
    borderColor (eight character hexidecimal color AARRGGBB)
    borderWidth (integer)
    borderOnTop (true|false)
    borderCornerRadius (positive decimal 0-90 degrees)

    Quote Originally Posted by pgpg View Post
    After a fling the button that is called stays pressed (still has the tint-color), if another fling starts on a button that is still pressed, both the fling target button and the button that the fling started on is called.
    I should probably refactor the fling and hardButton definitions to be page-level and define them as buttonTriggers. Then you can specify not to trigger display changes like the tint change and it won't set the button in a half-state that would cause the re-triggering you're seeing. Thanks for bringing this up.

  7. #457
    Join Date
    Mar 2007
    Posts
    277

    Default Andre 1.9.8f Available

    New in version 1.9.8f:


    + Fixed several crash-bugs particularly for new installations
    + Another batch of on-device editing changes (entity details editable for ButtonGroup, Text and Browser entities)
    + Enhanced the Entity Gallery a bit in preparation for default Entities

    Beta Expiration now set to November 15th

    http://www.andreapp.com/downloads/Andre-1.9.8f.zip


    Details:

    Fixed several crash-bugs particularly for new installations

    I've been seeing a handful of crash reports for various issues, I've fixed several bugs that cause force-close crashes.

    Another batch of on-device editing changes (entity details editable for ButtonGroup, Text and Browser entities)

    There are now fully populated editing tabs for Text, Browser and ButtonGroup Entities while in Edit Mode.


    Enhanced the Entity Gallery a bit in preparation for default Entities

    Mostly behind the scenes fixes and enhancements to the Gallery to allow for each Entity to have one or more 'default' entities that ship with Andre.

    The previous version will expire in two days. Please upgrade to this version to fix many bugs and avoid loss of functionality.

  8. #458
    Join Date
    May 2005
    Posts
    109

    Default

    Quote Originally Posted by HTLuke View Post
    What really needs to be added (on the to-do list already) is be able to define an error handling buttonTrigger when a web-service call fails for some reason. This way you could just tell it on error to send the WOL packet and pop up your own message to say something like "Please wait 60 seconds, the server is being started".
    What I meant was that if maybe I only opened Andre to (for example) send an UDP packet to some external hardware (when there is support for that). Then if I have a button that is triggered onResume (to sync some variable for example) and the HTPC isn't on I will have to wait for the dialog to close before I can do what I want. Then it would be better to (as you wrote) have a button triggered instead of showing the dialog.

    Quote Originally Posted by HTLuke View Post
    One question on the above implementation though; instead of posting the update directly to Andre in the way you describe, could you not send the update to Girder and store it there in a custom variable that Andre could then fetch? If the current active/desired state for the remotes were always represented in a custom variable(s) in Girder as the source of truth, then Andre (or any other FE) could sync to that data instead of needing to sync with each back-end component realtime.
    I did not do a good job explaining what I meant, I see that now when I reread what I wrote. When I wrote "media player", I meant a software on my HTPC. But let me give you another scenario. Lets say someone else in the household turns on a lamp while I have the lamp control page open in Andre. I then want to see the change in real time. Without polling.

    Quote Originally Posted by HTLuke View Post
    If you assign a hardButton to a Button you can have it trigger that functionality even when the screen is initially off, however right now Android turns on the screen when you do so.
    That is great, I didn't know I could do that. I don't mind that the screen turns on. I assumed I had to turn it on on the power button first. To bad I only have volume hard buttons on my device.

    Quote Originally Posted by HTLuke View Post
    There is a fair bit of complexity for anything but the most trivial layouts and it's easy to make one tiny typo that makes everything go weird. However there's also still plenty of weird behavior that doesn't initially seem to make sense, and I'm absolutely sure there's plenty of bugs left, so if you run into anything that is confusing or hard to resolve, don't hesitate to let me know and I'll gladly check it out and help you fix it.
    I did have some trouble with inheritance. When I wrote the following Andre told me I had cyclic inheritance.

    Code:
    <ButtonGroup id="id1">
     <ButtonGroup id="id2" inheritFrom="another_id">
      <Button id="btn1">
       <Parameter name="buttonLabel">Label</Parameter>
      </Button>
     </ButtonGroup>
    </ButtonGroup>
    But if I remove the outer ButtonGroup it works. Like this.

    Code:
    <ButtonGroup id="id2" inheritFrom="another_id">
     <Button id="btn1">
      <Parameter name="buttonLabel">Label</Parameter>
     </Button>
    </ButtonGroup>
    Is that how it is suppose to work?

    Quote Originally Posted by HTLuke View Post
    I'm about to post a new version that mostly is for pushing the beta date back again, but it has a good chunk of on-device editing features working, I'd love to get some feedback on it.
    I will try it and see if I like it better than xml-editing.

    Quote Originally Posted by HTLuke View Post
    Can you give me the version of Android you're using and whether it's a custom ROM or not? Normally it should re-enable the lock screen if Andre isn't the foreground app, but I've seen some versions/ROMs which behave differently than the version I'm developing on and testing with. I'd like to figure out why and try to fix it.
    I'm using Android 2.3.3 on an HTC Desire HD, it's the original ROM with HTC Sense.

    Some more questions:

    Is it possible to run a script on every page change? In other words, listen to changes to the andrePage variable? The reason I'm asking is because I want to create some pages (lets call them overlay pages) that have the capability to return to previous pages after some action (not necessary the previous page so I can't use linkPreviousPage) so I need to monitor page changes and save the last displayed non-overlay page.

    Also I would have to be able to go to a page in a script by specifying a page id.

    Is it possible to send a command to the web service from a script? It would save me a lot of code.

  9. #459
    Join Date
    Mar 2007
    Posts
    277

    Default

    Quote Originally Posted by pgpg View Post
    What I meant was that if maybe I only opened Andre to (for example) send an UDP packet to some external hardware (when there is support for that). Then if I have a button that is triggered onResume (to sync some variable for example) and the HTPC isn't on I will have to wait for the dialog to close before I can do what I want. Then it would be better to (as you wrote) have a button triggered instead of showing the dialog.
    I also and wanted to add an option for fire-and-forget IP/web service calls, so they get triggered but don't wait for response and if it fails it does so silently. I suppose if I made the error-handling buttonTrigger you could have a fail-silently path already through that, so perhaps I'll just focus on that functionality.

    Quote Originally Posted by pgpg View Post
    I did not do a good job explaining what I meant, I see that now when I reread what I wrote. When I wrote "media player", I meant a software on my HTPC. But let me give you another scenario. Lets say someone else in the household turns on a lamp while I have the lamp control page open in Andre. I then want to see the change in real time. Without polling.
    That is certainly the most valid use case for a listening server. I'm convinced, I'll start looking further into this very soon. There are multiple people that will probably be very happy to see this.


    Quote Originally Posted by pgpg View Post
    That is great, I didn't know I could do that. I don't mind that the screen turns on. I assumed I had to turn it on on the power button first. To bad I only have volume hard buttons on my device.
    Me too, and the trend is to move to less hard-buttons with tablets and such. The first company to make an Android device with a decent screen and half a dozen nice hard-buttons, I'll buy a bunch!

    Quote Originally Posted by pgpg View Post
    I did have some trouble with inheritance. When I wrote the following Andre told me I had cyclic inheritance.

    Code:
    <ButtonGroup id="id1">
     <ButtonGroup id="id2" inheritFrom="another_id">
      <Button id="btn1">
       <Parameter name="buttonLabel">Label</Parameter>
      </Button>
     </ButtonGroup>
    </ButtonGroup>
    But if I remove the outer ButtonGroup it works. Like this.

    Code:
    <ButtonGroup id="id2" inheritFrom="another_id">
     <Button id="btn1">
      <Parameter name="buttonLabel">Label</Parameter>
     </Button>
    </ButtonGroup>
    Is that how it is suppose to work?
    I'm not sure why the first example causes the cyclic reference, it is possibly a bug. I'll take a look. Though I'm not sure why you'd want the two nested ButtonGroups, the second example is what I do when using inheritance.

    Quote Originally Posted by pgpg View Post
    I will try it and see if I like it better than xml-editing.
    Thanks. I'd like to make the on-device editing comprehensive enough so it's at least as convenient as XML editing with the benefits of visual editing (and not having to worry about syntax errors, etc.) While one of the biggest differences is there's technically no inheritance (inheritance is an XML convenience; when loaded, everything gets explicitly expanded), but the concept of an Entity gallery, where you take something you've created (Button, ButtonGroup of Buttons, etc.) and add it to your Gallery so you can add that Entity to your pages as new, then tweak any values you might want to change.

    Quote Originally Posted by pgpg View Post
    I'm using Android 2.3.3 on an HTC Desire HD, it's the original ROM with HTC Sense.
    Ah, HTC does some weird stuff with the lock screen. I'll look into this.

    Quote Originally Posted by pgpg View Post
    Is it possible to run a script on every page change? In other words, listen to changes to the andrePage variable? The reason I'm asking is because I want to create some pages (lets call them overlay pages) that have the capability to return to previous pages after some action (not necessary the previous page so I can't use linkPreviousPage) so I need to monitor page changes and save the last displayed non-overlay page.
    Yes you can. When defining a <Page> you just add an attribute 'displayButtonTrigger', like so:

    Code:
    <Page id="myPage" displayButtonTrigger="myPage|myButtonId">
    ...
    </Page>
    I'm not sure if it fits what you're thinking of with overlay pages, but you can define your pages and add a ButtonGroup that is initially set to 'visible="gone"' and 'blockClicksbehind="true"' and add your overlay controls into that. Then when you click the button that should bring up the overlay, all you do is use the Parameter 'setEntityAttribute' on the ButtonGroup to change the visibility from 'gone' to 'visible' and back again when you're closing the overlay. I have a demo of this planned on my extensive examples list, hopefully soon.

    Quote Originally Posted by pgpg View Post
    Also I would have to be able to go to a page in a script by specifying a page id.
    You can actually call all Parameter functionality from within scripts. There's an object andreCommands pre-defined that let you call any of the same code paths that the Buttons call when executing Parameters. For switching pages, use:

    Code:
    andreCommands.displayPage( String pageId, String animationId, boolean forceReload );
    Where pageId is the page you wish to change to, animationId is the animation you wish to use for the transition (can be null) and forceReload is true or false if you want to cause the page to be reloaded from the config (typically false).

    Quote Originally Posted by pgpg View Post
    Is it possible to send a command to the web service from a script? It would save me a lot of code.
    Sure can, using the same method as before. The method call you want is:

    Code:
     andreCommands.callWebService( String domain, String port, String useHttps, String api, String username, String password, String timeout, String parameters, String resultVar, boolean runSynchronously, String buttonTrigger );
    All the values are what you'd set in all the service Parameters if you were doing it as part of a Button. They're all strings for this reason since even numeric fields like port gets parsed down the line:

    Domain is the ip or domain address
    port is the port
    useHttps is the string "true" or "false"
    api is your path/page
    username and password are for basic auth (null is ok)
    timeout is time in milliseconds before the connection is aborted before reply
    parameters are packed as name1=value1,name2=value2 (just like serviceParams)
    resultVar is the variable name for any result (null is ok)
    runSynchronously is "true" or "false" whether to block or not while calling
    buttonTrigger is the Button to call when the response is received.

    The scripting is extremely powerful, considering you can do almost anything JavaScript does, plus a full bridge into Java/Android code as well, and full access to the command objects for Andre. You could literally create your own Android UI behavior in script and do pretty much anything. In fact, there's no reason you can't use scripts right now to do UDP/TCP stuff if you were ambitious and knew some Android and Java programming.

  10. #460
    Join Date
    May 2005
    Posts
    109

    Default

    Quote Originally Posted by HTLuke View Post
    I'm not sure why the first example causes the cyclic reference, it is possibly a bug. I'll take a look. Though I'm not sure why you'd want the two nested ButtonGroups, the second example is what I do when using inheritance.
    I did have some more buttongroups inside the outer buttongroup at first. I wanted to group them together to simplify alignment.

    Quote Originally Posted by HTLuke View Post
    Yes you can. When defining a <Page> you just add an attribute 'displayButtonTrigger'.
    Works great. I run the following script when a page is displayed.

    Code:
    <Script id="onPageLoad">
      <![CDATA[
        var mytoast = Packages.android.widget.Toast;
        var message = 'String: \'' + andrePage + " " + '\'';
        var toaster = mytoast.makeText( Andre, message, 0 );
        toaster.show();
      ]]>
    </Script>
    However it seems as andrePage doesn't get updated when a page is displayed. It always shows the same page id in the toast. What I want to do is display the new page id in the toast.

    Quote Originally Posted by HTLuke View Post
    I'm not sure if it fits what you're thinking of with overlay pages, but you can define your pages and add a ButtonGroup that is initially set to 'visible="gone"' and 'blockClicksbehind="true"' and add your overlay controls into that. Then when you click the button that should bring up the overlay, all you do is use the Parameter 'setEntityAttribute' on the ButtonGroup to change the visibility from 'gone' to 'visible' and back again when you're closing the overlay. I have a demo of this planned on my extensive examples list, hopefully soon.
    What I want to do is have a global overlay which is available on all pages (to always have access to volume control and macros). What I do now is having a buttongroup which I inherit to every page, that buttongroup has buttons with links to the volume page and macro page. Works good.

    Quote Originally Posted by HTLuke View Post
    The scripting is extremely powerful, considering you can do almost anything JavaScript does, plus a full bridge into Java/Android code as well, and full access to the command objects for Andre. You could literally create your own Android UI behavior in script and do pretty much anything. In fact, there's no reason you can't use scripts right now to do UDP/TCP stuff if you were ambitious and knew some Android and Java programming.
    I have made some network applications in Android before so I might give it a try when I'm done with the rest of my layout.

    I got to say, the problem isn't the features of Andre, it seems to have all I ask for. The problem seems to be documentation so I have a way of knowing about the features. : )

    Some more questions and comments:

    I did try to use the volume buttons as hard buttons and it worked great, however when the screen is off the command usually doesn't get sent. Sometimes it works, mostly it doesn't. The wifi is still connected so it should be the problem.

    Is there a way to set the time before a button starts to repeat? Or is the delay connected to the gesture delay setting?

    Quite often after I press a button Andre displays it as pressed even after the press is done. This seems to happen more often after a refresh.

    When I use gesture="press" the button under always gets triggered too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •