Help with WebView - loading files locally - Android Software Development

I have a problem. I want to create a screen where a map (a picture) will be displayed, with some interaction (dragging, zoom, etc).
I started with creating an ImageView, but I found out that those gestures are still quite complicated to implement (couldn't find a single example that I could work with). Then, someone suggested me that I could use a WebView instead, as it would act as a workaround to those gesture issues. Indeed, switching to WebView did solve some of my problems.
However, I do have a new problem derived from this. As of now, to display the image, the terminal requires an internet connection; I've found out how to load files locally, but only if they're on the terminal itself (as in if the file is on the sdcard). Is there any way to access the image without having to store it separately from the program? Like when accessing the drawables?
Sorry if this a basic question, I'm pretty much starting and the amount of tutorials/information available is either dated or confusing. Btw, I'm developing on Froyo.

Related

[Q] Real-Phone AVDs for download?

I'm semi-adept at programming, and I've got a pretty good game on the Market (Porcupine Assassin, if you wanna check it out).
Long story:
Problem is, some features work on a "grid" system, which generates it's layout on startup based on the phone's physical properties. Now, I only have a G1 and the grid system works fine on it. But a user has received an FC caused by "Array Index out of bounds" which means the grid system was trying to access a section of the grid that was not generated. It wasn't generated because the user's phone has a difference screen size than mine, and obviously the grid failed to adapt properly.
Short story:
I need a way to download emulator AVDs that are identical to real-life phones. I don't have the know-how to reproduce them myself (I use a basic AVD for all my testing). Is there a site that has custom AVDs for download?
I seem to recall an option when installing my AVD to set the screen resolution. I poked around and didn't find any way to change it once it's installed though.
With my x10 I went to the se dev site and there was a preconfigured avd. I'm assuming other companies do the same. Hope it helps

[XAP][Source] Webserver v0.6.0 (File uploads)

Version Alpha 0.6.0 is now available
I'm back! Not dead yet, I promise. This is actually a relatively small update in terms of user-facing features, with only one really big new thing - support for file uploading - but that's a lot bigger than it might sound. It's the first write support I've implemented in the server, and it also required some fairly massive updates to the HttpServer component (support for binary requests, for POST parameters, for MIME multipart parsing). These will be built upon in forthcoming versions to add support for things like registry editing, in-browser file viewing (possibly editing), and so on. There are also a large number of small fixes and improvements that I've made over the last two-weeks-shy-of-a-year, which should make the server faster, more robust, better able to support concurrent connections, and lighter on device resources. Finally, while the app still targets WP8.0 and should run on 8.0, it now is designed for 8.1 compatibility (especially the AllCapabilities version).
Previous update (0.5.6): This version is mostly bug fixes and UI changes. The biggest changes are: clearer display of weird registry data types, the server now consumes fewer threads (it used to spawn them with wild abandon) and does faster string compares, the app version is now shown on the phone, error pages are now better, if you launch the app without a WiFi IP address it'll offer to take you to the WiFi settings page, connections are no longer closed as soon as the app starts sending a response, and the server now defaults to using the Connection: keep-alive header, with a two-minute timeout. The last change, combined with the second-to-last, should hopefully both do away with the tendency to have the app fail to display a page. However, I shouldn't have *needed* to switch it to "keep-alive" - using "close" should have worked - but it still veeeery occasionally would kill the connection early. Agh. Anyhow, this is better in the meantime.
DevDB offers me a support / Q&A thread. Please use that thread to ask questions; don't PM me unless it needs to be kept private for some reason!
ISSUES ON WP8.1:
It *should* work to deploy the app with "Application Deployment", but if you have a problem try deploying with "Windows Phone Application Deployment 8.1" instead.
Problems have been reported in the past when the app is installed to the SD card. It's small, though; putting it on internal storage shouldn't be a problem.
RESOLVED The AllCapabilities version included a few capabilities that were present in 8.0 but removed in 8.1. Those capabilities have been removed; the AllCapabilities version now deploys and runs on capability-unlocked WP8.1 phones.
IN CASE OF OTHER ISSUES: Please provide a *detailed* error report - what phone and OS version you have, what hacks you've installed, what Webserver version you're running, what you do to get the error to occur, and exactly *what* occurs - and I'll fix it as soon as I can! There's a DevDB section for posting bug reports, and you can also use CodePlex if you want.
I finally implemented file upload! I'll work on getting more stuff like that (file delete, possibly file rename/move/copy, various registry edits), hopefully soon! I also hope to add support for different areas, like an "Applications" path, a "Processes" path, a "Services" path... eventually. Many of those are really hard without good privileges. I'm also looking at moving the server to a background process and making the app just a control UI for it, adding support for authentication and/or HTTPS, adding some stylesheets to the web UI, adding caching, and much more. I did finally implement Connection header support.
Once again, the XAP is published twice. One is a fairly standard XAP that any phone can sideload, and the second has many exotic capabilities to enable viewing of (and writing to) slightly more of the file system and registry. The standard XAP has had its list of capabilities expanded to pretty much all of them that can be used without interop-unlock. The high-capability variant requires not just interop-unlock, but the additional capability-unlock hack available in the interop-unlock thread. The AllCapabilities version now works with WP8.1; sorry for the long delay on that!
An item of note: the AllCapabilities version (or either version, on WP8.1) can open other drives in the file system. On phones with an SD card, it is mounted at D: and you can browse it as normal. Credit to @hjc4869 for this discovery!
DESCRIPTION: This is a simple webserver app which can enumerate those files that are in folders readable from the sandbox, can download and upload (access permitting) files, can browse the registry, and can display the contents of registry values of any type. It runs on WP8.x (not yet tested on W10M). It is a spiritual successor to the Functional Webserver / WebServer (Mango) projects from WP7. This version is still missing a lot of functionality as I decided to implement it from scratch, but it is advancing swiftly. Note that there's no access controls implemented; use it on a public network only at your own risk!
Instructions are simple: sideload the XAP, connect to WiFi (required), run the app (called "WebServer Native Access"), point a web browser (on a PC or phone that is also on that local network) to the URL that the app displays. You should get a basic index page. Click on a Filesystem or Registry link to begin browsing the phone. There's a textbox near the top of all filesystem pages, type in a path there (for example, "C:windows" with no quotes) and hit Enter or click Get Files. You'll see a list of the contents of that folder. Click on a file to download it or a directory to open it. There's also a box for uploading files, one at a time, to the current directory. Navigating the registry is similar, except you'll need to specify the registry hive and then the path from that hive (or no path, to access the root of the hive).
As of v0.6.0, uploading files is finally supported! Other modifications (editing files, creating, deleting, or changing registry keys or values) are currently not supported. They will be "soon" although my personal testing suggests that basically the whole registry, and most of the file system, is off-limits for writing unless you use restricted capabilities.
You might see an error code (error 5 is "ACCESS_DENIED", you'll see it a lot; I should replace it with an appropriate 403 or whatever). Or you might see a status 500 message because of an exception in the server. Or the server may just crash (hopefully not so often anymore...). I'm making it more resilient, but there are still bugs. Please report any previously-unreported issues you find, including how to reproduce them, and I'll fix them if possible.
Also feel free to request features or changes; I'll implement them if reasonably possible. The app is a mixture of C++ and C# code; I could probably have done it all in one or the other but wanted to have a C++ component in case I ran into something that wasn't available in C#, and although it probably would have saved some time, I decided that hacking up a web server in C++ was maybe not the best idea.
The source code is on Codeplex, at the following projects: https://wp8webserver.codeplex.com/ for the server and the app (C#) and https://wp8nativeaccess.codeplex.com/ for the native access wrappers (C++). You may have to fix up the reference paths to get the C# component to see the C++ component correctly. The code is reasonably well documented, but let me know if you have any questions. Permission to re-use the code or components is granted under the MS-PL (Microsoft Permissive License) as posted on Codeplex.
Go forth and find cool stuff!
Version history (see the git commit logs for more detail:
07 July 2013 - 0.2.0: Initial release, FS only, 920 downloads (source: 652 downloads)
14 July 2013 - 0.3.2: initial registry, HTTP server and web app encapsulation, source on Codeplex, 225 downloads
0.3.3: bugfixes, 454 downloads
0.4.2: basic registry values display, 86 downloads
0.4.3: bugfixes, 326 downloads
0.4.6: multistring registry values, bugfixes, updated libraries, first AllCapabilities version (950 downloads), 453 downloads
25 Oct 2013 - 0.4.8: binary and long registry values, formatting and bugfixes, 451 downloads AllCaps, 201 normal
22 Dec 2013 - 0.4.9: all registry value types, better threading, proper resume, remembers port, 97 downloads AllCaps, 53 normal
24 Dec 2013 - 0.5.0: background operation using Location APIs. Downloads: 1011 AllCaps, 963 Normal
20 Jul 2014 - 0.5.1: More capabilities, better navigation. Downloads: 358 AllCaps, 352 normal
07 Aug 2014 - 0.5.3: .REG export, better traversal, bugfixes. Downloads as of 0.5.5 release: 260 AllCaps, 164 normal
10 Oct 2014 - 0.5.5: Bugfixes and back-end work. Downloads as of 0.6.0 release: 140 AllCaps, 113 normal
25 Oct 2014 - 0.5.6: Bugfixes and UI tweaks. Downloads as of 0.6.0 release: 1720 AllCaps, 1334 normal
12 Oct 2015 - 0.6.0: Binary requests, file uploads, bugfixes.
XDA:DevDB Information
WebServer Native Access, Tool/Utility for the Windows Phone 8 General
Contributors
GoodDayToDie
Source Code: https://wp8webserver.codeplex.com/
Version Information
Status: Alpha
Created 2014-10-17
Last Updated 2015-10-12
I'm going to use this space to mention something that's pretty cool:
J. Arturo of http://www.komodosoft.net is using a modified version of the HTTP server that powers this app in the ShareFolder app (http://www.windowsphone.com/s?appid=e2b9c82e-eaa1-4a3b-9d4a-8a2933a8bdb4) to support opening video files directly from Windows network shares! This was done to work around a limitation of the WP8 media control: it can only source from an isolated storage file or a HTTP URL. By running a server in the background and streaming the video file through it, and pointing the video player control at the localhost URL, it becomes possible to play the file on the phone without first copying it to the app's isolated storage. A very cool way to solve the problem! Also, reviewing the changes that were made to the network code of the server pointed me toward those threading fixes I made that have hopefully much improved version 0.4.9.
Please note that the updated version of ShareFolder with this feature may not yet be available, although it should be soon. It is a commercial (paid) app, but the author sought and received permission to use my code (although the license does not require such permission be received).
What exactly is the problem with sockets? I am battling myself with sockets atm too, maybe we can share knowledge?
Strictly speaking, the problem was with the phone's limited subset of the Sockets API forcing me to access it through functions I wouldn't normally use (asynchronous everything, SocketAsyncEventArgs and lambdas and AutoResetEvents and so on everywhere...) but I've got a pretty good handle on it now, at least for the System.Net.Sockets.Socket and its friends. The new .NET 4.x ones (using the async keyword and all) are in a different namespace; I didn't mess with them. They are more abstracted from the Bekeley sockets interface that I'm used to from C, but they are also (supposedly) more user-friendly, especially if you don't feel like writing all your own thread management code (and in fairness, I should re-write the webserver's threading to use threadpools; they're better for this type of work).
If you want to ask questions about the topic, I suggest starting a new thread (possibly in the Q&A subforum, although it's also dev related...) and I'll answer if I can.
GoodDayToDie, just an idea: how about sharing your source code via CodePlex or GitHub?
Oh man, this is pretty nice! GoodDayToDie does it again!
So far, I can read \Windows, the current install folder which you access just by typing "." with no quotes and the current application folder by typing ".." I can access the .dlls, .winmd and AppManifest.xml from the current install, but from everywhere else, it goes boom. This is a great step towards something awesome though!
EDIT:
I was wrong. For some reason, when you click on a folder it's trying to "download" it, rather than chdir. I can get pretty far into the Windows directory.
THAT's what you meant by "Click on a file (note: there's no current way to tell the difference between files and folders) to download it.
You might see an error code (error 5 is "ACCESS_DENIED", you'll see it a lot). Or you might see a status 500 message because of an exception in the server. It's getting a lot more resilient but there are surely still some bugs. ".
If you see a folder, just type the full path to it instead of clicking on it and you will be able to read the contents.
ANOTHER EDIT:
I just found a file inside of the \Windows\System32 directory named [guid].devicemetadata-ms (It's easier to just search for "devicemetadata-ms"). It's a cab file with some metadata about WP8 with a sign.cat and packagesign.cat file in the archive. I don't know what these files could potentially be useful for.
New version in a day or two (busy tonight). Features I plan to implement (not necessarily in the next version or at any particular time):
File upload (IsoStore and, of all crazy things, install directory are writable. I think I'll put a flag on each FS page that says whether the current dir is writable...).
File deletion (where possible, of course).
File and Directory distinction in the listing (clicking a dir should open it, not error out).
Filesystem index page with links to folders that can be accessed successfully (since the root isn't readable).
Some more file info (size, probably attributes, possibly permissions).
Possibly an option to preview a file (as plain text) without downloading it.
Some kind of background mode (the server uses minimal resources when not actively servicing a request, so I'll see if I can get it to work in the background, perhaps by abusing the music transfer agent...)
Some kind of offline mode (at least basic file browsing within the app, as an alternative to using the web interface, though I might just make a second app for that).
Source code changes: separate the server code from the webapp / phone app code (move it into its own project).
Source code changes: move to a hosted version control service, probably CodePlex (good suggestion sensboston).
Maybe add an icon and such...
Any other suggestions?
I also want to try experimenting with various non-standard capabilities and see if I can get access to more of the system . I've already added the ability to access removable storage, but I've also found a bunch of really weird and frequently undocumented capabilities in the OS's policy configuration files, and I need to look into those... The interesting (and possibly the uninteresting) ones are probably blocked for unsigned sideloaded apps, but it's worth checking on anyhow.
Yeah sorry, I should have been more explicit about clicking on dirs. not working in 0.2.0. Also, it's "unofficial" but if you check the URL bar you'll see a URL parameter called something like "pattern" (by default, it's *) and if you change that, you can filter the results. For example, "foo*.exe" (note: no quotes!) will search for EXE files whose names start with "foo". Among other uses, this makes it a lot faster to load large dirs like System32. This will be added to the UI at some point. Also note that URL decoding is applied correctly to querystring parameters (Probably already noticed with the path sometimes written using %5C for \) so you can add special characters that way if needed, though currently any of them but \ will probably just cause an exception.
...
Actually, does this filesystem support Alternate Data Streams? If so, you should be able to download them by appending a : and the ADS name to the filename in the download URL...
OK, so that was a new version in five days. Sorry, stuff takes time.
The source code is now on Codeplex. The native access portion is at https://wp8nativeaccess.codeplex.com/, and the web server portion is at https://wp8webserver.codeplex.com/. Both are licensed MS-PL and use Git for version control. The full XAP is also available for download from the Webserver project on Codeplex.
GoodDayToDie said:
OK, so that was a new version in five days. Sorry, stuff takes time.
The source code is now on Codeplex. The native access portion is at https://wp8nativeaccess.codeplex.com/, and the web server portion is at https://wp8webserver.codeplex.com/. Both are licensed MS-PL and use Git for version control. The full XAP is also available for download from the Webserver project on Codeplex.
Click to expand...
Click to collapse
You are a god. I'll be sure to post my findings .
Hmm. When I first load up WebServer File Access then access from my laptop, I get the main page then the program crashes on my phone. It seems to hold a lock on to the socket as i can no longer access port 9999 from any other device when re-opening the app. I can access it again when I reboot, but the same thing happens.
EDIT: I think it may be due to the WiFi at work... it's junky. I'll try again when I get home. I was just able to browse some directories.
Wow, that's completely unexpected... I can beef up the error chacking and handling around the listener port though. That part of the code is really straightforward, so I actually haven't hardened it very much. I can also put in a Finally block to close the socket and/or mark the socket as re-usable so that other apps (or the same one again) can listen on it in the future.
I also plan to add support for setting your own port, but that doesn't solve the underlying problem. I'll put in more error reporting as well, to enable better debugging. Thanks for the report! Always good to have users report problems so I know where to prioritize fixes.
GoodDayToDie said:
Wow, that's completely unexpected... I can beef up the error chacking and handling around the listener port though. That part of the code is really straightforward, so I actually haven't hardened it very much. I can also put in a Finally block to close the socket and/or mark the socket as re-usable so that other apps (or the same one again) can listen on it in the future.
I also plan to add support for setting your own port, but that doesn't solve the underlying problem. I'll put in more error reporting as well, to enable better debugging. Thanks for the report! Always good to have users report problems so I know where to prioritize fixes.
Click to expand...
Click to collapse
I tried the app at home and it DOES crash on the first hit of the home page, but I'm able to open it up again and it works fine.
The new version 0.3.3 should be more rebust; try it and let me know if you still have issues. If you do, let me know what the exception message is (and any other info you can provide) and I'll try to track it down.
Downloading really big files should also work now. The app will read and push files in smaller chunks (the code to do this existed in the NativeAccess library before, but wasn't used).
a simple SDK?
Dear Sir
Will it be possible for you to make some sort of SDK from this so other developers can integrate this into their apps and enable browsing isolatedstorage?
Sorry if it is a stupid question.
Bruce_X_Lee said:
Dear Sir
Will it be possible for you to make some sort of SDK from this so other developers can integrate this into their apps and enable browsing isolatedstorage?
Sorry if it is a stupid question.
Click to expand...
Click to collapse
With the restrictions in permissions, this app only allows browsing of the app's isolatedstorage locally. You are able to use the IsolatedStorage API within your app to browse files and directories already.
snickler said:
With the restrictions in permissions, this app only allows browsing of the app's isolatedstorage locally. You are able to use the IsolatedStorage API within your app to browse files and directories already.
Click to expand...
Click to collapse
That's right. What I want is to allow the end user to be able to browse the isolatedstorage. Imagine I have a video download app, I want the user to be able to transfer those downloaded videos from the app's isolated storage to, say, a PC.
One can do this by integrating the webserver code into the said app.
Bruce_X_Lee said:
That's right. What I want is to allow the end user to be able to browse the isolatedstorage. Imagine I have a video download app, I want the user to be able to transfer those downloaded videos from the app's isolated storage to, say, a PC.
One can do this by integrating the webserver code into the said app.
Click to expand...
Click to collapse
Ahh I see what you mean now. That sounds like a pretty nice idea. I think more research needs to be done to see whether it would even be allowed in the marketplace.
The webserver portion is stand-alone (builds to its own .NET DLL with no dependencies on the other parts) and has a pretty clean interface. You'd need to implement the web application portion of it yourself - the thing that generates the response pages for a given request - but the HttpResponse class in the server does a lot of the work of that for you; you basically just specify the content you want to send (as a String or byte array) and it sends it.

[Q] Nook Simple Touch disable screensaver & full screen browser

Hi,
First of all, thanks for great set of resources! I was rooted an up and running with market in no time.
I am planning to use the Nook as a home automation controller, where the interface is presented through a webpage. For that, I am going to have it mounted and constantly powered-up.
So, my question is - how can I disable screensaver to have the Nook show the browser 24/7?
Also, is there any simple way to show contexts of the browser window without the navigation buttons? (If not, no worries - I can put something together quickly in PhoneGap or similar).
Thanks!
Bumping for interest - has OP/anyone found a solution to this? I'm going to have a tinker with the sys files in the next few days to see if I can manipulate those, will post any positive results.
I'm looking for always-on functionality as part of a live bus timetable / weather station project I'm 75% through.
For those interested, I'm running a simple PHP server pulling data from London's TFL API and the UK MetOffice's Datapoint API and displaying the page in Dolphin.
julianfox said:
Bumping for interest - has OP/anyone found a solution to this? I'm going to have a tinker with the sys files in the next few days to see if I can manipulate those, will post any positive results.
I'm looking for always-on functionality as part of a live bus timetable / weather station project I'm 75% through.
For those interested, I'm running a simple PHP server pulling data from London's TFL API and the UK MetOffice's Datapoint API and displaying the page in Dolphin.
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?p=29113425 (found by googling "nook screensaver disable sqlite3").
julianfox said:
Bumping for interest - has OP/anyone found a solution to this? I'm going to have a tinker with the sys files in the next few days to see if I can manipulate those, will post any positive results.
I'm looking for always-on functionality as part of a live bus timetable / weather station project I'm 75% through.
For those interested, I'm running a simple PHP server pulling data from London's TFL API and the UK MetOffice's Datapoint API and displaying the page in Dolphin.
Click to expand...
Click to collapse
Hi, I am quite interested in your project and was wondering how you got on with this.
Basically I am looking to have a calendar + weather page up constantly on in my rooted Nook Simple Touch. I have managed to get rid of the screensaver but it still goes into sleep mode after a while. Also would like to get some direction on how I could do my own PHP based page because most of the calendar apps out there dont seem to report weather
Jayyzee said:
Hi, I am quite interested in your project and was wondering how you got on with this.
Basically I am looking to have a calendar + weather page up constantly on in my rooted Nook Simple Touch. I have managed to get rid of the screensaver but it still goes into sleep mode after a while. Also would like to get some direction on how I could do my own PHP based page because most of the calendar apps out there dont seem to report weather
Click to expand...
Click to collapse
I implemented the server side part of this weather app
http://www.mpetroff.net/archives/2012/09/14/kindle-weather-display/
also made the following changes
http://www.shatteredhaven.com/2012/11/1347365-kindle-weather-display.html
Getting the image on the nook is a different story. I tried using crond to wget or curl the image from the server to the screensaver folder so I could have other info graphics rotated throughout the day. I was unable to get the image via wget and unable to get cron working. Any suggestions... (besides having a browser open 247)
here is another example
http://origami.phys.rpi.edu/~jimenc/public/pjs/weather_kindle/server2/weather.php
Refresh?
larryflynt said:
Getting the image on the nook is a different story. I tried using crond to wget or curl the image from the server to the screensaver folder so I could have other info graphics rotated throughout the day. I was unable to get the image via wget and unable to get cron working. Any suggestions... (besides having a browser open 247)
Click to expand...
Click to collapse
Hi, kudos for the progress so far.
I take it you couldn't just use another device to FTP the file to the nook every so often?
I was hoping to do a very similar thing with my spare NST but unfortunately my coding skills are not up to that level. You mention that you were trying to populate the screensaver folder with the image to be displayed, would there be any way to automatically make the NST wake up every few hours to refresh this image (assuming you can get the image there in the first place)?
I think that the better way to do this all is to write an app.
The app could use either an ImageView or a WebView.
You could easily make this work directly without a proxy or a server.
You wouldn't have to play around with screen timeout/wakeup,
This is going to be hard wired powered?
Renate NST said:
I think that the better way to do this all is to write an app.
The app could use either an ImageView or a WebView.
You could easily make this work directly without a proxy or a server.
You wouldn't have to play around with screen timeout/wakeup,
This is going to be hard wired powered?
Click to expand...
Click to collapse
The more I think about this, the nook simple touch might have to be charging.
I've done something very similar with my nook showing a custom weather listing in a fullscreen Dolphin browser. Though I have a problem with it not running for more than a day or so before the browser stops refreshing anymore. Have you experienced this? I'm currently looking into some way to kill/restart the browser on schedule perhaps.
Also, how did you get the browser in landscape mode? I can't find that anywhere.
neonpolaris said:
Also, how did you get the browser in landscape mode? I can't find that anywhere.
Click to expand...
Click to collapse
I use this to set the orientation: https://play.google.com/store/apps/details?id=com.mah.screenrotationlock
OB
Sent from my HTCEVOV4G using Tapatalk 2
Another way to set orientation is if you have an application that only does landscape.
Switch to the landscape app, home out of that, go to the application that does both.
It should stay in landscape mode.
I have an assortment of apps, some portrait only, some landscape only, some both orientations.
By jumping briefly to a landscape only or portrait only app you can set the orientation for subsequent apps.
Thanks for the help guys!
I've got a web server running on my NAS serving a custom page for me. The browser launches fullscreen on boot up via some auto start app. After 5 min, the page redirects to an all black page for a second, then an all white page for a second (to clean up the display), then back to the original page with any new information on it.
This works well except for two issues.
1. On boot up, there's no way to avoid the first lock screen. After unlocked, it doesn't come back, but it's always there on startup. This wouldn't really be an issue except...
2. The browser stops loading the page after a while. I can hit refresh and it goes through the motions, but the page isn't updated. It can take a couple of days for this to happen. Restarting the nook solves this. I confirmed that the page is still served normally to other devices (not a web server problem). I would just have the device auto restart at 3am or something, but then the lock screen would always be there.
Do you guys have any ideas about how to correct this or at least work around it?
I can't even try other browsers because this is the only one I've found that displays full screen.
Any updates on this?
I wonder if there's a way to have a cron job kill and relaunch the browser every once in a while to get past the freezing issue you'd mentioned. Or just have the cron job kill the browser every once in a while and relaunch it, pointed at a new information display page.
Even better would be if there was way to bypass the need for a web browser and interact directly with the e-ink screen buffer as can be done on rooted kindle devices. (I can't post a link, but google search "Tools Eink Framebuffer Update Trigger" to find the kindle framebuffer commands)
Yeah, I worked directly with the screen output on my kobo, which worked well, but it was more of a pain to make changes. That might be because I'm more familiar with php and css than python and screen blit-ing. Having android to work with makes it much easier to expand functionality by just downloading an app and using my fingers, instead compiling software and ssh-ing in for everything.
Speaking of which, it looks like my problem is solved. I installed tasker and set it to kill the browser at 3am and start the browser at 3:01am. Thanks all.
What about google play apps for weather? Most of the apps I have used so far have had contrast issues since they are designed for color screens. Does anybody know of good apps that display the current weather info and forcast data in an eink friendly color scheme?
As far as the going to sleep issue, the apk listed in the second comment here: http://forum.xda-developers.com/nook-touch/general/fridge-calendar-t3057759
worked without issue for me, so that problem has mostly been solved.
Try this: electricsign app
Apologies for the resurrection, but for those looking for a digital low power / e-ink info display this might just do it.
This app will do the trick if a static jpg of a web page updated at an interval will do (set to output a jpeg in the custom screensaver folder on rooted nook)
Electricsign android app: (search electricsign on the play store - I can't post a URL here yet).
Leave the WiFi on and set the screensaver timeout.
The source code is on github also (google.it ).
I can never find the app because I always think it's called electricsheep.
Hope this helps someone...or me in the future.
Hi future me, the app is called electricsign, not electricsheep. You'll thank me next time you forget. From your past self bored at a ceildh BC your gf doesn't want to dance.
electricsign looks like the ticket!

[Q] Last read confusion

I'm using the stock nook reader and renate's Library.apk. How can you make sure the last read icon on the top bar corresponds to the last read file in the library?
I am not sure where this icon gets its link. It doesn't seem to always open the last read file.
I've been thinking about asking this question (although I am using the stock reader AND library apps). My "reading now" button is getting really cranky of late. It often just goes to the first page (cover) or sometimes it goes to the first page AND displays a two-option message about the different current reading positions in two Nook readers (!) and which one do I want (generally neither is correct). Right now the only sure way to get to the correct page is to go to the Library screen and select the book from there. So the Nook does remember, but the Reading Now button is not functioning properly.
For a time I had a number of B&N apps disabled (renamed ".bak") and gradually discovered the imponderable connections that seemed to render little things inoperable. I've had to restore quite a few of the apps to running to keep everything functioning except Nook Community (because the constant "nagifications" drove me crazy) but this button behavior has me baffled (as does the reference to two Nook readers!)
I wonder, are you using any sort of "cleaning" app? I am using Clean Master and find it helpful in freeing up memory but I'm beginning to think that some of the data it is throwing out might just contain the info that the button needs to function properly. It certainly messes with Tasker.
The "Last Read" icon on the status bar sends out the intent com.bn.nook.launch.LAST_BOOK
This would normally be handled by Home.apk
If you deleted Home.apk and are using my Library.apk it has its own receiver for that.
Depending on which version Nook software you have it will query
content://com.bn.nook.reader.providers.lastreadingpointprovider/
content://com.bn.nook.reader.common.providers.lastreadingpointprovider/
The LRP database is maintained by the Reader(RMSDK).apk.
Checking for the latest modification gives you the last book read.
My Library.apk sends an intent out to open that book.
Currently Library.apk does not update the order of books displayed in "Last read" unless the refresh button is hit.
Two things to look for if you are having problems:
If you let the battery die and the WiFi is always off the clock time will be wrong.
If you crash or shutdown improperly Reader(RMSDK).apk will not get a chance to update the LRP.
P.S. I just noticed a possible anomaly if you read PDF's in the reader too.
Oh! It just occurred to me one thing.
I remember opening a book that you have been reading already and it opens at page 1.
This was tied to opening the book in different ways.
There are different ways to open a book:
Through the "Last Read" icon and stock Home.apk
Through the stock Library.apk
Through my Library.apk
Through a file manager application
The LRP database is /data/data/com.bn.nook.reader.activities/databases/lastreadingpoint.db
Code:
CREATE TABLE lastreadingpoint
(_id integer primary key autoincrement,
ean text, // file URI
luid text,
offsetrmsdk text, // subfile path fragment
lastupdated long, // Unix milliseconds last read
bookdna int, // always 1?
sync_status int // always 1?
);
ean (which normally might stand for European Article Number, i.e. "UPC") is a URI, not a path.
Code:
sqlite> select ean from lastreadingpoint;
file:///sdcard/Books/aboveall.epub
...
There may be cases where a single book gets different ean's.
If you could look at LRP and see if this is so?
I actually managed to locate that db file on my own (!) and what seemed to be a companion with related information (readerlocal.db). They seemed to be full of junk info (books that had since been removed, etc.) although there were no duplicate entries, which is what I had suspected.
Anyway, I got a little "brave" (i.e., foolhardy) and decided to clean up both files in a parallel way. Then I pushed them back, reset the permissions and rebooted.
Yikes. My Nook is set to go to the B&N Home screen only on reboot. That screen flickered and flashed, never filling in any of the images. I could still use the "N" button to access other parts of the system and they were working fine, but any return to the Home screen via the Back button showed it was still in distress.
So....restore from backup...again.
It seems OK for now. I have noticed that the little "refresh" button in the Library does sometimes seem to go on and on and on without any accomplishment. I have suspected the issue was how I accessed the book-in-progress as you described. Since I sometimes read more than one book at a time, I'm all over the place with how I do things (including a Library icon in my App home screen). I'm going to try being more disciplined for a while and see how it behaves.
nmyshkin said:
I actually managed to locate that db file on my own (!) and what seemed to be a companion with related information (readerlocal.db). They seemed to be full of junk info (books that had since been removed, etc.) although there were no duplicate entries, which is what I had suspected.
Anyway, I got a little "brave" (i.e., foolhardy) and decided to clean up both files in a parallel way. Then I pushed them back, reset the permissions and rebooted.
Yikes. My Nook is set to go to the B&N Home screen only on reboot. That screen flickered and flashed, never filling in any of the images. I could still use the "N" button to access other parts of the system and they were working fine, but any return to the Home screen via the Back button showed it was still in distress.
So....restore from backup...again.
It seems OK for now. I have noticed that the little "refresh" button in the Library does sometimes seem to go on and on and on without any accomplishment. I have suspected the issue was how I accessed the book-in-progress as you described. Since I sometimes read more than one book at a time, I'm all over the place with how I do things (including a Library icon in my App home screen). I'm going to try being more disciplined for a while and see how it behaves.
Click to expand...
Click to collapse
Would it be possible to write an app that simulates opening the last read book from only one of the Library apps and then map that to the last read icon to simplify this whole system?
mergen3107 said:
Guys, if you are concerned about why sometimes the last read option goes to the 1st page, then it was already fixed by our forum users somewhere here. (I could hardly remember and trace where it all started but finally it was successfully solved)
Just install a file this package (internal.db deep in the 'data' folder. You could delete 'system' folder - this is hyphenations dictionary for Russian) through cwm or replace it manually (the zip contains detailed path) and here you go.
Click to expand...
Click to collapse
Now that was an interesting trip! Once I had Google do some translating there were a number of really interesting posts that were (mostly) intelligible. I'd want to compare that modified internal.db file with what's already on my Nook before I did any replacing. A lot of the work from that site is "russified" (not surprisingly) and there may be other changes there not really needed/wanted, but it's a good start.
I noticed in another posting there that someone said there is a related issue with in what state the Nook is connected via USB. Apparently the hypothesis is that if you don't connect while in the Library you stand a good chance of scrambling the "reading now" database entry. I've certainly been hooking up with my Nook in all kinds of states, so if that's correct, no wonder my database file was so messed up!
Installation of the internal.db file from the Russian source will not work. I've tried a side-by-side comparison of the file with the one from my Nook (FW 1.21) and there are differences (beyond the region identifier, which is easily changed). It's not at all clear what changes have been made or from what firmware the modified file came. In any case, it causes havoc when exchanged for the native internal.db
The Russian discussion points to this thread on XDA which approaches (and apparently solves) the problem another way. I'm going to give it a try.
nmyshkin said:
Installation of the internal.db file from the Russian source will not work. I've tried a side-by-side comparison of the file with the one from my Nook (FW 1.21) and there are differences (beyond the region identifier, which is easily changed). It's not at all clear what changes have been made or from what firmware the modified file came. In any case, it causes havoc when exchanged for the native internal.db
The Russian discussion points to this thread on XDA which approaches (and apparently solves) the problem another way. I'm going to give it a try.
Click to expand...
Click to collapse
Do I read this correctly, http://bit.ly/Q7MytN from that thread there should be no problem if renates Library.apk is used exclusively and the stock Library.apk has the bug?

Windows Hooking question

Is it possible to create an application that would hook all api calls to windows and be able to accept or deny the call? How trivial would this be?
All calls, for all apps? Very damn hard. You'd basically need to shim the entire standard libraries. The shims could probably be programmatically generated, but you'd need to write the program to create them. Then you'd need Admin access to install them, and then...
Why don't you explain what you're trying to do? This is a very complicated thing to attempt, and it might not be the right approach at all,
GoodDayToDie said:
All calls, for all apps? Very damn hard. You'd basically need to shim the entire standard libraries. The shims could probably be programmatically generated, but you'd need to write the program to create them. Then you'd need Admin access to install them, and then...
Why don't you explain what you're trying to do? This is a very complicated thing to attempt, and it might not be the right approach at all,
Click to expand...
Click to collapse
Due to recent program vulnerabilities *cough cough* IE exploit, I want to create a program to minimize and effectively stop the exploits, by blocking reading api calls from programs that have the vulnerability and determining if the call should be made or not.
There's already tools like EMET, which blocked that (and may other) exploits.
Have you ever looked at the output generated by procmon on a typical Windows application? Even for just the subset of system calls that it monitors, the log scrolls too fast to read, much less to make a decision about each call. Something as simple as opening a single static HTML page in IE would require an incredible number of clicks. Your typical modern page, which has dozens of separately-requested elements, generates considerable traffic to log files and cookies and so forth, and may contain rich content requiring a bunch of additional functions... Yeah, not practical at all.
GoodDayToDie said:
There's already tools like EMET, which blocked that (and may other) exploits.
Have you ever looked at the output generated by procmon on a typical Windows application? Even for just the subset of system calls that it monitors, the log scrolls too fast to read, much less to make a decision about each call. Something as simple as opening a single static HTML page in IE would require an incredible number of clicks. Your typical modern page, which has dozens of separately-requested elements, generates considerable traffic to log files and cookies and so forth, and may contain rich content requiring a bunch of additional functions... Yeah, not practical at all.
Click to expand...
Click to collapse
For educational purposes and further knowledge could you show me what I would have to do to hook one api call from a process? it does not have to be a global hook.
There's a handful of possible approaches.
If you *wanted* to do it globally, and didn't mind doing so only at the kernel syscall layer (meaning any purely user-space code wouldn't get caught, but since anything that can go between processes in any practical way involves the kernel anyhow...) you could create a driver that filters the relevant system calls. Filtering the entire system call interrupt at one place is possible if you can mess with the relevant interrupt service routine, but I believe that's protected by PatchGuard. There may be some all-in-one place anyhow, but it would be tricky. Anyhow, this is how tools such as Process Monitor (which only handles a relative handful of system calls) work.
If you want to modify the behavior of a bunch of programs, you could create modified versions of the system libraries, and put them where the programs would load them (usually the application directory would work, but sometimes you would need to replace the system copy). This approach is a lot of work, though not completely impractical; you simply need to shim all the exported functions (or at least, the ones you care about) with a version that filters the call before passing it through to the "real" version, but you would need to cover all the exported functions without breaking their ABI. Doable, but a lot of work.
If you only want to get one function, the easiest way would be to re-write all calls to that function in the process memory such that they go to your filter instead. This is how the Detours library (http://research.microsoft.com/en-us/projects/detours/) works; you can find code samples of using it online. I believe that is also how Microsoft's application compatibility shims work. There are registry keys which will cause a given program to be loaded in a debugger (which can be mostly non-interactive, and just make this change for you) or I *think* there's a way to specify an arbitrary DLL that a given program must load (and run its DllMain function) when it starts up too, which would also do the trick.
Bear in mind that the second and third methods can be bypassed by an attacker who knows what you're doing; the attacker just (re-)overwrites the function tables to point at the real versions of the APIs, or alternatively makes the relevant system calls directly (Win32 programs basically never do this, instead letting the Win32 subsystem translate their Win32 function calls in NT system calls and invoking the wrapped syscall, but there's nothing *stopping* them). The first approach can't be bypassed by an attacker with less than Admin privileges (assuming you did it right; I can think of a couple of potential gotchas you'd need to avoid) but you would need Admin yourself in order to install that driver in the first place, and if you want to *interactively* filter the API calls you would need the entire interaction path including the UI to protected against tampering by less-privileged processes.
With all that said, a real Mandatory Access Control that gives finer-grained control than Windows' Mandatory Integrity Control would be a really cool thing (something more like SELinux or AppArmor). It would probably be more effort on NT than on Linux though, due to NT not (so far as I know) having any equivalent of http://en.wikipedia.org/wiki/Linux_Security_Modules (a good place to start reading about the topic).
GoodDayToDie said:
There's a handful of possible approaches.
If you *wanted* to do it globally, and didn't mind doing so only at the kernel syscall layer (meaning any purely user-space code wouldn't get caught, but since anything that can go between processes in any practical way involves the kernel anyhow...) you could create a driver that filters the relevant system calls. Filtering the entire system call interrupt at one place is possible if you can mess with the relevant interrupt service routine, but I believe that's protected by PatchGuard. There may be some all-in-one place anyhow, but it would be tricky. Anyhow, this is how tools such as Process Monitor (which only handles a relative handful of system calls) work.
If you want to modify the behavior of a bunch of programs, you could create modified versions of the system libraries, and put them where the programs would load them (usually the application directory would work, but sometimes you would need to replace the system copy). This approach is a lot of work, though not completely impractical; you simply need to shim all the exported functions (or at least, the ones you care about) with a version that filters the call before passing it through to the "real" version, but you would need to cover all the exported functions without breaking their ABI. Doable, but a lot of work.
If you only want to get one function, the easiest way would be to re-write all calls to that function in the process memory such that they go to your filter instead. This is how the Detours library (http://research.microsoft.com/en-us/projects/detours/) works; you can find code samples of using it online. I believe that is also how Microsoft's application compatibility shims work. There are registry keys which will cause a given program to be loaded in a debugger (which can be mostly non-interactive, and just make this change for you) or I *think* there's a way to specify an arbitrary DLL that a given program must load (and run its DllMain function) when it starts up too, which would also do the trick.
Bear in mind that the second and third methods can be bypassed by an attacker who knows what you're doing; the attacker just (re-)overwrites the function tables to point at the real versions of the APIs, or alternatively makes the relevant system calls directly (Win32 programs basically never do this, instead letting the Win32 subsystem translate their Win32 function calls in NT system calls and invoking the wrapped syscall, but there's nothing *stopping* them). The first approach can't be bypassed by an attacker with less than Admin privileges (assuming you did it right; I can think of a couple of potential gotchas you'd need to avoid) but you would need Admin yourself in order to install that driver in the first place, and if you want to *interactively* filter the API calls you would need the entire interaction path including the UI to protected against tampering by less-privileged processes.
With all that said, a real Mandatory Access Control that gives finer-grained control than Windows' Mandatory Integrity Control would be a really cool thing (something more like SELinux or AppArmor). It would probably be more effort on NT than on Linux though, due to NT not (so far as I know) having any equivalent of http://en.wikipedia.org/wiki/Linux_Security_Modules (a good place to start reading about the topic).
Click to expand...
Click to collapse
I want to write open sourced code that will be like super user and permissions for windows so you can have the open feeling of windows but a secure feeling as well with little to no anti-virus's. This would not be like windows rt's locks, you can run any program you like.
You're not the first person to have this idea, but I don't think you understand the magnitude of what you're asking for. Even if such a system were created, it would be a lot of work to create all the rule sets for every program you want to protect. Besides, you'd still be vulnerable to malicious code that runs as Admin (i.e. most installers, etc.) since they could unload or modify your driver.

Categories

Resources