How to create an background activity in app inventor - background-process

I wanted to create an app in appinventor that would switch screen right/left depending on what side the phone is shaken while unlocked. But couldnt figure out:
a. how to make application run in background.
b. what property i am going for. Like what tells phone's screen to scroll left or right when finger slides across the screen. What method is called. I figured view class would have to do something with it. Having no java experience i couldn't make much sense out of sdk,refernce,resources etc.
Please help me out, i will give you credit for it.
Oh also i think i might have to include "activity starter" too.

It's an issue for app inventor
http://code.google.com/p/app-inventor-for-android/issues/detail?id=32
star it to show you are interested

The standard Application Inventor 2 website, as you surely know, is this one:
http://ai2.appinventor.mit.edu/
However, there is another one, which allows using background threads (services):
http://services.appinventor.mit.edu/
It has a feature not available on the standard (official) AI2 website, the Add Task functionality, which allows adding tasks that will keep running even after a screen have been closed.
However, since it is an unsupported version, whose last release is dated from almost 1 year ago, I did not spent time making experiments, but this migh meet what you need:

The website will turn down, but worked like a charm before.
The whole concept was based on a Master Thesis: https://dspace.mit.edu/bitstream/handle/1721.1/100626/932752939-MIT.pdf;sequence=1
The last message from the site was something like: Google change the concept of background service architecture which cause the 'taks' concept to obsolate and prevent to work in the future.

Related

web accessibility - play audio on button hover

i have a few buttons on my site with audio playing on button hover.
i have main sound on/off toggle button on my navbar.
my question is if it's accessible to play an audio on mouse hover and not on button click? since the user doesn't expect to hear sound when hovering on an element.
i can't find anything on wcag site about play on hover. nothing but this https://www.w3.org/TR/WCAG21/#audio-control
What an interesting question!
Short answer
Don't play sounds on hover automatically without the user explicitly setting the sound to "on" on the site first.
This isn't just an accessibility issue this is a user experience issue, playing sounds without asking permission first is a terrible practice as your user may be reading your page in a library or on a train and will not expect sounds.
If you really want sounds on your site I would suggest a popup on site load that allows a user to enable sounds if they wish.
Longer Answer
Does playing a sound on hover break any rules in the WCAG?
There is no specific guidance as far as WCAG is concerned as to whether a sound can play on hover.
However there is a lot of general guidance that is very closely related that although doesn't specifically mention this scenario is close enough that we can infer whether or not this is a good idea.
I would recommend referencing guidance G170: Providing a control near the beginning of the Web page that turns off sounds that play automatically, guidance G60: Playing a sound that turns off automatically within three seconds and guidance G171: Playing sounds only on user request
You will see there is a common theme, give users the choice as to whether they want sounds and if you do play sounds automatically make sure they don't last more than 3 seconds.
There is also one other thing to consider
The unspoken rule(s) of accessibility
These aren't hard and fast rules but in accessibility there are two things applicable to this question you should always strive to adhere to.
1. Follow Expected practices
Navigating the web I expect to see certain things. If I click a link I expect the page to change, if I click on a picture I expect either nothing to happen or that image to pop up in a lightbox or open in a new page.
Expected behaviour is a key part of accessibility for all sorts of people with disabilities, but especially those with anxiety disorders and those with cognitive impairments.
Having a sound play on hover could startle, scare or confuse certain people or be very distracting for others (e.g. someone with ADHD or Autism).
2. Try to offer the same experience to all users.
The other thing you are doing wrong is offering a different experience to different users.
If someone has mobility issues / accuracy issues (e.g. Parkinson's Disease or Cerebral Palsy) then they may use a keyboard instead of a mouse and will not hear the sounds that mouse users experience on hover.
For this reason if you implement sounds make sure they fire on both the focus state and hover state.
So with all of the above in mind what should you do?
The simplest answer is not to have sounds at all, but you may have a good reason you want sounds on hover / focus.
So the first thing you should do is give your visitors a choice when they first land. Do they want sounds on the site or not.
Instead of switching it on automatically people should explicitly tell you that they want sounds to be played on the site. If they dismiss the message assume they do not want sounds.
This will also help screen reader users etc. as not every screen reader user uses a keyboard (for example someone with severe Dyslexia may hover over items to have them read out loud, your sounds on hover would interfere with that).
The second thing you should do is make sure that no sound plays when over your switch to turn sounds off (in case someone switched them on by mistake), or at least make sure that sound is less than 3 seconds if you really must have a sound. For all other buttons / links etc.
I would probably say make sure sounds last no more than 3 seconds, although one scenario where this may be allowed is if hovering a link previews an audio file. If this is the case I would make sure that when someone decides to enable sounds it is clearly stated that some links may play audio for more than 3 seconds.
The final thing you should do is make sure that sounds are played on hover and on focus. You should give your keyboard users the option to enjoy the same experience as mouse users if they want.
Finally - reconsider using sound. It is likely just going to annoy your users anyway as hearing a sound every time I hover an interactive element is soon going to get frustrating if I have been on your site for more than a minute.
Obviously there will be valid use cases for sound on hover, but there are probably very few of them.

How to unfullscreen a window without notifying it?

I'm trying to enhance the gTile extension by allowing it to resize a fullscreen window to a tiled area of the screen. That's a pretty common thing to do when tiling and it's pretty handy since some windows will hide some chrome when in fullscreen mode. But I'm having the hardest time figuring out how to do that.
Searching the internet led me to this forum post which mentions EWMH and _NET_WM_FULLSCREEN. I've tried to find ways to access window manager hints but can't find anything bashing by head on Looking Glass or scanning through the docs. Is this kind of thing possible through a shell extension?
Meta.Window is likely what you are looking for:
https://gjs-docs.gnome.org/meta4~4_api/
Setting Window.decorated = false may be able to remove the title bar or perhaps getting the compositor object and changing it from there. However this will still keep the address and tab bars in chrome. You may need to find another method to signal chrome to hide those.
There is not really an easy way to do this, the thread you linked is in regards to VLC and modifying it's source code.

How do I make a mobile-friendly popup on my website?

Is there a simple way to trigger a mobile OS's native pop-up/alert/etc. from some form of web code? I'm writing an ASP.NET mobile web page and I'd like to, for example, have the iPhone's UIAlertView appear.
EDIT: What I'm looking for is not the method with which to detect which mobile browser is accessing the site (I already know how to do that). If the code to trigger a pop-up that will look nice in an Android browser is different than the code to trigger a pop-up that will look nice in an iPhone browser, I can simply throw in a switch statement that redirects the user to the pop-up that corresponds with their browser. I'm trying to find the html/javascript/asp.net code which will create a mobile-friendly pop-up, either in general or for the various popular mobile web browsers specifically.
Don't know whether there is any pre-built functionality in .NET that can achieve this, but you can surely write one yourself.
You can write a method, that returns the code for your popup, based on the user OS (simple switch statement should do).
EDIT after taking a short nap:
I believe you should reconsider using popups. They are quite annoying even on desktop browsers and many people block them automatically. Probably every blog about accessibility will tell you, that you should keep mobile version of your website as simple as possible because of various compatibility issues that you can run into.
Instead, try to think about some interesting way to incorporate messages for users in a different and appealing way, that won't disturb anybody.
What I do is use a div popup (that floats ontop of the page) and eighter make a big close button or set at timeout to remove it.
jquery mobile is a good place to start.

Using QT For Creating a Screen Dimmer

I'm trying to implement a screen dimmer using QT4 and I wanted some advice before I get cracking instead of going into this blindly.
I want to create a top-level window that has no frame. I was thinking of making the background black and messing with the opacity so that it will dim the screen out after the system is idle for a given period of time.
The problem with this is that if this window is always on top, how can I pass click events to the window underneath it? I'm not the least bit familiar with the windows API (the solution only has to work under windows), but I'm guessing that's a good place to start. Can anyone point me to some useful classes/functions or suggest another way of doing this via QT?
If anyone's interested in the solution I came up with and the windows API functions I used, you can check out my blog posting here: http://sarcastichacker.com/getnextwindowandgetforegroundwindow
I will be updating the source and making another related posting on the same blog within the next couple of days.

What are some good patterns for managing a bunch of views/screens in Flex?

I'm building a Flex application with about a dozen different screens. There's relationships between the screens such as when on screen 1, I click on something that is an input to screen 2. Then I might bring up screen 3, then go back to 2 and then bring up screen 4. To make it clear to the user where they are in the application, we'd like to implement a breadcrumbs concept where the user gets to see which screen they are and be able to navigate back up the trail they came from.
So in thinking about how to implement this, it seems to me that I should have a stack of views. Views get pushed onto the stack, then popped off. The breadcrumbs would be a visual depiction of that stack, eg: Home >> Alert 123 >> Customer B Summary >> Customer B Detail
Having said this, I'm trying to come up with a pattern for how to implement this. The obvious starting point would be a mx:ViewStack as a container. Then I'd add views as children and make them visible - effectively "pushing" then onto the view stack. Then to close that screen I'd remove them as children to "pop" them off. This would have to update some stack data structure somewhere that the breadcrumbs would be able to see. In fact the breadcrumbs themselves can modify the stack when the user clicks on an item in the breadcrumbs to jump to.
In any case, I'm going to be working on this but just curious if anybody has anything to share around any patterns/frameworks you've used to manage multiple screens and how they come up and go away and navigate between them that I can use for some ideas.
Seems like a simple thing but in practice it's not always straight-forward.
MVC i think would be helpfull to orgenize your code and have a rebustable application .
There is no 100% design pattern ,most times it is the way you implement it .
I find mvc great when having many views because it keeps your mxml pretty clean and small and when you add features you do it in a pure as class which keeps your code from complicationg.
Just throwing some ideas, hoping it can help ...
Maybe you could use the memento pattern? Or use a command pattern with a CommandStack?

Resources