Can't download cilent generated file in Android Chrome - android

Ok, there's a long history behind this one, but the gist is that we need to create and download a little bit of text CLIENT side, into a file called "test.lbl". Assume we can't access the server side.
The following code (coffeescript) does this by creating a Blob, converting it to a data url, and then clicking the link. This works GREAT in a desktop Chrome browser. However, in Android Chrome (not sure what version exactly, but I just installed it as of 3/5/13 from Google App Store) this simply won't work. In Android Chrome, the file starts to download and then just spins. (In fact, it shows in your "Ongoing" for quite some time, even after the browser is closed.)
Anyone know why this might not work in Android? Perhaps a different mime type will make it allow the file to be downloaded? We're dealing with internal tablets so we can relax any site specific security settings we need to.
Or, is there a better way to go about this entirely? (client-side generated text file download)
Thanks
$("#get-label").on 'click', (e) ->
e.preventDefault()
bb = new Blob(['test test test'], {type:'text/plain'})
evt = document.createEvent("HTMLEvents")
evt.initEvent("click")
$("<a>", {download: 'test.lbl', href: webkitURL.createObjectURL(bb)}).get(0).dispatchEvent(evt)

This is a known issue in Chrome for Android. I have raised an issue https://code.google.com/p/chromium/issues/detail?id=181032 - if you star that you will be able to see all the updates for it.

Related

anchor tag link to pdf file in android firefox

Executive summary: can't display a pdf file on Android Firefox.
I created an HTML page on my laptop and displayed it using Firefox. The page is a simple menu, consisting solely of links to my wife's sewing machine manuals, like so (skipping over header, title, and stuff, no css, not xhtml):
<p><ul>
<p>
<p><li><a href="file:///storage/3C5D-4F8A/Manual/thing.txt">
<strong>Thing
</strong></a></li>
</p>
<p><li><a href="file:///storage/3C5D-4F8A/Manual/overlockbasics.pdf">
<strong>Overlocking Basics
</strong></a></li></p>
<p><li><a href="file:///storage/3C5D-4F8A/Manual/allaboutthread.pdf">
<strong>All About Thread
</strong></a></li></p>
</p>
...and so on. The goal is to have the manuals handy to the sewing machine. The phone is handy.
On a laptop, clicking the link pops up the associated pdf file, which is expected behavior. However, when I put the HTML file on her phone (and after adjusting the file paths), clicking a link returns a 'unable to download file' message.
To insure I had the correct path at least, I put that 'thing.txt' link in; clicking that returns the contents of the thing.txt file ("This is a thing", if you were wondering), so the path as specified seems correct, and that at least the text display 'plugin' works.
Tried attaching a 'type="application/pdf"' to each anchor tag, but that had no effect. From what I've discovered, Firefox is supposed to have a built-in PDF viewer - a sensible notion - although I have a suspicion that it only works with downloaded files...but if that's true, why does it work on the Win10 laptop? Inquiring minds want to know. True, there are some differences between the two platforms, so perhaps that's just the way things are.
To reiterate, the files I'm trying to display are right there on the phone's storage card.
The phone is a Galaxy S5 sport (android version 6.0.1); Firefox version is 68.3.0.
The laptop is Win10, Firefox version is 71.0.
I see that other people have had problems sort of like this, but their issues appear more complex. This does not seem to be complicated, aside from the common not-working part.
If someone can suggest a solution that doesn't involve third-party add-ons, or reconfiguring Android, or dragging Google into the process, (or as someone suggested elsewhere, writing one's own browser), it's appreciated. Prefer someone pointing out what I'm doing wrong. It's entirely possible that something so simple cannot be simply done.
To see what happens on a Raspberry Pi (mainly because it was handy), I mounted the Samsung as a mts device, modified each anchor tag's path to a single dot/slash preceding the PDF file name, and ran the HTML file into both Firefox ESR, and then Chromium. Oddly, both browsers spontaneously opened and populated tiny PDF windows corresponding to each href; no link click was required. So all that demonstrated is that Firefox behaves differently depending on the platform; I'm glad you were all sitting down for that revelation. Still, it was interesting, in that those browsers had no trouble displaying something. Note I'm not complaining about that; it was just an experiment.
To recap - main interest: Firefox on the Android not displaying PDF when anchor tag clicked.
Thanks.

Android app - generate a non-editable report

I am new to Android development and would like some advice from some more experience developers.
The app I am developing is effectively a form for servicing products (i.e. does x work, does y work etc.. ). Once the form has been completed a "report" of some kind needs to be generated in a non-editable format! Initially I was thinking to display a confirmation page and when confirmed by the user simply screenshot the report, however I realise this is a hacky solution and would be rather limiting! So basically I would like some input on what options I have to implement such a feature! To be clear the output file MUST be non-editable... i.e. an image file or pdf!
Also FYI - the report file will be uploaded to a dropbox/a specified folder.
PDF files seem to be a good solution for you. I would rather create a Web Service to deliver the pdf, because some devices will be really slow creating a pdf, but if you decide to take a client approach, take a look at:
http://code.google.com/p/droidtext/
http://sourceforge.net/p/itext/code/5420/tree/tags/iText_2_1_7

iOS equivalent to Android MODE_WORLD_READABLE

As the title says - is there something in iOS that lets you say 'this file is allowed to be accessed by other apps' - preferably only readable, but read/write would be good enough.
Basically I am trying to place a file outside the sandbox so other apps can read it - preferably via the openURL that points to a local file rather than an http address.
Thanks
Edit:
I just received an answer from Apple Tech support and they told me that this is currently impossible (just after iOS 6 released)
I don't think it's possible to do it the way you describe. Last I checked, apps can only write inside their sandbox dir and cannot read inside other apps' sandboxes (though IIRC there used to be a few other writable directories).
What, exactly, is the end result you are trying to achieve?
If you know the app you want to read the data, you can use a custom URL scheme.
If you have a file of a certain type (extension/content-type, I think), you can use UIDocumentInteractionController to let the user pick an app to open it in.
If you just want to share some data with any app, the closest I can think of is a custom UIPasteboard. OpenUDID does this for a slightly dubious purpose.

BIRT, Android and reports

We have an IBM Maximo system that has BIRT reports built in. We are also in the process of writing an Andriod app that needs to be able to run a report (on the server) and get the PDF version back into the app (or at bare minimum, the HTML version of the report). Is there any built-in functionality for this with BIRT or Maximo??
My team have something similar, but we scrapped the idea of using the .rptdesign files stored on the maximo server, and solved it by setting up the BIRT runtime: (Download here).
If you have direct access to the DB you can setup the runtime with the report(s) you need and play around with the parameters.
Say that one have a report called "report1" stored on "localhost:8080" and the report contained 2 parameters called "StartDate" and "EndDate" this is how one would do it:
Instead of using the standard URL with the frameset servlet mapping: "localhost:8080/birt/frameset?__report=report1.rptdesign" and let the user run the report them self, change the servlet mapping to run.
To just run the report, without getting the parameter dialog to provide values for the two parameters, one just have to parse the parameters to the end of the URL - &StartDate=2011-01-01&EndDate=2011-01-02.
To download the file in PDF format append the viewer command option "__format=PDF" to the end of the URL.
So the end result will look like this:
localhost:8080/birt/run?_report=report1.rptdesign&StartDate=2011-01-01&EndDate=2011-01-02&_format=PDF
This will download the file in PDF format without any interactions to the actual BIRT runtime.
Hope this gives you some ideas anyways, I know it's not an optimal solution. But at least it's something.

Android Installation of APK via Browser Link

I want to create a web page that has two links. One that downloads the agent itself (which is pretty easy, just linking to the APK file with the appropriate MIME types set), and the other to start the install process for the APK downloaded in step one.
I know they can just pull down the bar and click on it, but that can be confusing for users (especially in the overall process we are trying to create). Is there a special URI I can use to start the installation, sort of like the market link of "market://"?
Also, is there a way to get meta-data surrounding where the APK was actually installed from? For example, if the link for the APK is "http://company.com/setting=123", that I can pull in the "setting=123" from the URL? I suspect not, but I figured it couldn't hurt to ask.
You can add url interceptors to your app like it's mentioned here but AFAIK there is no way to do what you are asking.
check open2go.com
it may help you.
example here
http://open2go.com/http://m.getjar.com/mobile/49757/angry-birds-seasons/
open2go.com/ + url
market: schema works to.

Categories

Resources