[Q] Make invisible WebView emit onDraw() event - Android Q&A, Help & Troubleshooting

Hi all
(Sorry, double posted this question cause wrong section for first post. I didn't find a way for remove my previous post, kindly ask to moderator to remove it, thank you)
My question will be quite strange but is what I need unfortunately. Basically I need to create an invisible WebView instance (invisible mean not showed inside the activity) and get screenshot from the showed web page every time something change in the page. No problem from get screenshot, the problem is the way to be advised when something change inside the web page currently loaded into my webview. Please note, changes I need to get can be also some images changed "on the fly" by javascript code inside the page, these kind of "events" can no be detected by standard calls like onloadpagefinished or so on (since images changed are preloaded). Another problem can be when images are fully downloaded by the browser but not yet showed in the view (in case of slow CPU per example). Normally I could to easily fix my problem by overriting the onDraw() event of the webview. Every time onDraw() event is emitted mean that something is changed into the view and I need to get new screenshot. Unfortunately my problem is onDraw() event is emitted only if the view is currently visible inside the activity. If the view is "hidden" or "offscreen" as my case the onDraw() event is not emitted since, obviously, doesn't need it. Android views lifecycle explained in the main android developer site show why this happen (the view is set in pause state once out of visible activity part). Now my question is: is there a way to "force" the view to manage onDraw() event as it would be showed but in offscreen mode like my case?
Thank you to all will can help me

Related

Can you turn off safe search for Google Now??

Hello boys & girls.
I have just performed my first ROM flash on my S3 with Android Revolution HD 14 :laugh:
With Jellybean comes Google Now, the Android equivalent of Siri. I have been experimenting with this and have discovered that despite my Google account settings being set to safe search filter off, and that I have turned off the Block Offensive Words option in settings, Google Now filters things by default.
For example, if I say 'Images of Large Hadron Collider' Google Now will duly serve me image results as requested, but if for example I say 'Images of furious sweaty butt sex' it just provides me with a web search and I subsequently have to select images myself. Even when I do, it takes me through to images that have quite clearly been filtered. Not only this, but if I were to request images of something where there were mixed images of clean and not so clean, it would only serve me up the filtered pics.
So my question; is there a way to turn off the safe search elements so that my internet can be delivered to me as I wish, or do I have to put up with Google not showing me what I have requested? (which isn't furious sweaty butt sex)
PS - I'm sorry if this is a duplicate question in some way; I did a search but could not find anything pertaining to this particular line of enquiry
Doommidget said:
Hello boys & girls.
I have just performed my first ROM flash on my S3 with Android Revolution HD 14 :laugh:
With Jellybean comes Google Now, the Android equivalent of Siri. I have been experimenting with this and have discovered that despite my Google account settings being set to safe search filter off, and that I have turned off the Block Offensive Words option in settings, Google Now filters things by default.
For example, if I say 'Images of Large Hadron Collider' Google Now will duly serve me image results as requested, but if for example I say 'Images of furious sweaty butt sex' it just provides me with a web search and I subsequently have to select images myself. Even when I do, it takes me through to images that have quite clearly been filtered. Not only this, but if I were to request images of something where there were mixed images of clean and not so clean, it would only serve me up the filtered pics.
So my question; is there a way to turn off the safe search elements so that my internet can be delivered to me as I wish, or do I have to put up with Google not showing me what I have requested? (which isn't furious sweaty butt sex)
PS - I'm sorry if this is a duplicate question in some way; I did a search but could not find anything pertaining to this particular line of enquiry
Click to expand...
Click to collapse
There should be an option for google now under settings; 'block offensive words' untick that box
22sl22 said:
There should be an option for google now under settings; 'block offensive words' untick that box
Click to expand...
Click to collapse
Did that already, all it seems to do is stop starring out letters of swear words, didn't change anything else
Any further suggestions from anybody?

[Q] Android touch data logs

For a research I am doing, I need to some way to track user touches when they are using the phone in general daily basis. The user will be fully aware about what they are recording. Any method to do would be great.
What have I tried so far?
Method 1. Create an service with overlay transparent view.
Problem Due to obvious security flaws this is prevented starting with ICS. The input touches on the transparent view is not transferred to background and hence user is not able to interact with phone normally. I tried various methods with overlay view defining as type phone or type system alert or switching between them during program execution.
Method 2. View with 1% screen size make with touch outside model
Problem As problem as previous. Touch outside only returns the if touch event happened outside without even initial x, y coordinates.
There are other methods I tried but those are highlighted. Currently, I am thinking about other options:
Option 1 - The pointer location option in developer options: In settings there is this pointer location option that I can utilize. When that option is on, all the info about touch are shown in the top panel. If I can have access to those data afterwards that would be fine too, despite the fact that there will be drawings on the screen when user is using the phone. I have traced the source code of ICS and found the core class that is making that tracking possible. I recreated that class into an service. The logcat shows all the info about touch when I am running it from app. Only problem is the same as problem 1. I cannot track it outside current app. So, if it logs the tracking info even when pointer option is turned on, how will be able to get the information later to use?
This option seems the easiest.
Option 2 - Android NDK If above method is not possible is it possible to do so using NDK? Right direction to this route is also great.
Option 3 - Custom ROM Do I really need to go for Custom ROM while doing this? I am pretty sure this is 100% sure way to do it. But it is seeming very impractical in this particular research and would like to avoid as much as possible.
I would appreciate any suggestion to the path that I can follow. Thank you all in advance.

[Q] Soft keyboard with HTML5

Hi there, first time poster. I was wondering if someone could answer a few questions for me as it pertains to HTML5 and bringing up a Keyboard on Android (any version). I am a website developer and I have recently gotten into making my web applications mobile friendly, but I'm running into some snags when trying to get a certain keyboard to show up on Android / iOS and I'm wondering why it's not a bigger issue than I've seen so far.
Right now, if I add an <input> onto my page and add type="number", Android will pull up a keyboard that has numbers, etc. My problem is, the field I'm using isn't a "real floating point number", which all major browsers (except IE11) disallow. If I have an input set up to take a credit card number, I cannot allow the user to add dashes to make it easier to read while using type="number". However, I'd rather have the number keypad pop up by default as it really is all numbers, just not a calculatable (is that a word?) number.
I was wondering how difficult it would be for Android to add in something so when a field is clicked into, it would look for a specific vendor prefix to load a soft keyboard of the web developer's choosing? For instance:
Code:
<input type="text" data-soft-keyboard="number">
or
Code:
<input type="text" data-soft-keyboard="email">
which will give the device very clear and explicit instructions on which type of keyboard to display.
Sorry if this seems way out in left field, but I haven't found a decent solution to this issue. I went to Chrome forums to discuss and people said Chrome is 100% working off of the HTML5 spec. My personal opinion is that the HTML5 spec is wrong and why the hell are browsers doing validation against data in textboxes when I didn't specifically ask for it. However, I'm not really sure which direction to go at this point.
Any suggestions or opinions on the matter would be very nice, thank you

[q] epub rendering fails when the data connection is on

Hi everybody. This is my problem:
I’m trying to read some epub3 ebooks using the Astri-Bee reader on an Android phone (an LG L4II with Android 4.1.2). As soon as I open any of these books I get a message like this:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
If I turn off the data connection (the data connection thorough the mobile network), the error changes to:
Pagina web no disponible.
Es posible que la página web htp://0.0.0.0:49346/OEBPS/Text/1.xhtml se encuentre temporalmente fuera de servicio o se haya trasladado a otra dirección web de forma permanente.
(Sorry for the Spanish, I have this device in Spanish. Basically, it says a web page cannot be reached in the place addressed by the url htp://0.0.0.0:49346/OEBPS/Text/1.xhtml)
If I turn on the WiFi (keeping the data connection off) the problem solves magically and the epubs render fine.
If I turn off the WiFi (without turning de data on) the books still display fine.
If I turn back on the mobile data connection the rendering may be ok for a while, but, in the end will fail.
Some of these books I’m trying to read with Astri-Bee are examples created for the IDPF to help developers to test their readers (and designers to understand the epub standard). They are expected to have no design errors. In addition, I’ve tested them with the Kobo epub reader (in the same device) and (with Kobo) they display without any errors.
It seems to me that Astri-Bee is using some functions provided by Android (to extract the epubs' contents) and that they fail in certain conditions (when the mobile data connection is on, mainly). Unhappily, I have no idea on how the guts of Android work. It might be even something completely different, like a software conflict or so. This looks like a mystery to me.
Thanks in advance for any help you may provide.
Mmmmm… No answers yet. May be I didn't post this appropriately; may be nobody knows how to help me out of this thing. Let's try to move a little beyond and set down some plausible reading of these weird symptoms. They are gonna be plain speculation, but may be a speculation leading someone to have an idea on how to help.
An epub is a simple "linear" web site packed with some metadata (by mean of using zip compression). An epub reader basically is a web browser layout engine wrapped in a particular interface (with some specific-purpose functionalities). I haven't been able to find in a quick search any information about the guts of Astri-Bee, but I guess it's probably implemented by mean of reusing a named web browser layout engine. That seems to me the most sensible. Being so (and given the symptoms described, above, in the first post), Astri-Bee probably works this way:
- It recovers the metadata and builds the ebook internal structure, index an so on.
- It calls the web-browser-engine to lay out the first html inside the book. Being this engine for web browsing, its call probably requires as parameters an IP address, a port and a path. Astri-Bee passes them all.
- In order to make the book html reachable to the engine, Astri-Bee serves it in the localhost 49346 port (being ../OEBPS/Text/1.xhtml a normal path inside an epub).
- Finally Astre-Bee shows the engine-laid-out html being the first element of the book.
I can add here (to the symptoms described in my first post) that, when the data connection has just been turned off, and Astree-Bee is showing the web-page-cannot-be-reached message, the Astri-Bee page up/down functionality perfectly works and makes it browse the same message for further pages:
A web page cannot be reached in the place addressed by the url htp://0.0.0.0:49346/OEBPS/Text/2.xhtml.
This seems a hint leading to think Astri-Bee is properly unzipping and decoding the metadata, and only fails at browsing the htmls contained inside the book (when the data is on). Which reinforces the idea under the working-steps described above.
As already stated, all this may look like plain speculation. In fact, it is. But seems sensible and looks by now like the most probable explanation to me. It means Astri-Bee is probably using functions provided by Android to manage the network connections it needs for (self) serving and reading the epub htmls. So a crash in the way Android manages or provides these services when de data connection is on will lead to such symptoms as the described above in the first post.
I don't know how to test this thesis I've set up in this seccond post, and what’s more important, I can't even hint how to solve the rendering problem I described in my first post. I'm qualified but not at all an operative system authority and Android is way far from my expertise. Still need some help.
Anyone out there with some ideas?
Come on. I can't believe there's no one in this forum with a useful idea. Not one asking to make sure the software versions are the last ones. I've already checked that. One, I mean, that brings light to this problem. That helps me out of it.
I'm willing to check and try any sensible suggestions. :fingers-crossed: One of those ebooks is a demo of a functionally advanced epub and Astri-Bee has proved itself as the best epub renderer out there. It would be great to have that pair working in this phone of mine, as I already have them working all right in my tablet. :cyclops:
I look forward to your comments, guys, if there're any.

[Q] Need a little help with settings in my app

Hi all, first off, im brand new to android development, this question might seem stupid, i've searched and looked through the wiki, but couldnt find the answer to my question (hoping I didnt miss it) .
In my login screen on my app, i want to be able to choose from two ore more locations in a Spinner (not linked with language, that is chosen seperate). Selecting one of these locations will change 3 WSDL in a seperate class to match that location (right now its 2, but itmight expand in the future). I got the spinner up and running, but not sure how i can deal with the code and logic behind the spinner selection. How can the spinner selection set which WSDL links to connect to?
Any ideas? I hope it makes sence, if not , please ask and i will try to elaborate more deeply.

Categories

Resources