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
Related
I'm just wondering how the following scenario can be solved:
I want to write a very simple app for my daughter. The app displays 4 colored fields on the activity and through speech output says something like "tap green". She should then tap the green field to get positive feedback. So far, so easy.
I then thought it might be nice if the app would also "grow" as she grows older. Maybe later I want to have a game mode where I display animals, numbers, vehicles, etc., so it would be nice if I could have something like "Shape sets" - basically a set of images along with a description of what the app should say for each image. Also easy enough - all you need is a set of images and an XML file describing the images.
BUT
I'd like to be able to install these "Shape sets" as additional APKs later on, so that I don't have to modify the app every time. I'd like to install the APKs, so that the contents are added to a specific sub folder on the SD card, into which my app looks to enumerate available "Shape sets".
If I ever published the app to the Play Store, other people should also be able to download the "Shape sets" I create (no need for user contributions, though).
Is that possible? If so, what would I have to do to have the Android OS "copy" the contents of an APK to a specific folder (lets say "/TapGame/Shape Sets/Animals") on the SD card? Or is there even another way of achieving what I want that I didn't think of?
The term "plugin architecture" just came to my mind as I wrote the question. Searching using that term I found this question: Extend my android app in different APK
It seems to provide a solution to my problem - I'll investigate this further, but please feel free to suggest other possible solutions!
Is that possible?
Um, sure.
If so, what would I have to do to have the Android OS "copy" the contents of an APK to a specific folder (lets say "/TapGame/Shape Sets/Animals") on the SD card?
Android won't do any of that. You have to do that. You would have to detect that a "shape set" APK was installed (either watching for package-installed broadcasts, scanning all installed apps for ones that seem to be a "shape set", etc.). Then you would have to arrange to copy whatever you wanted to wherever you wanted it, either by:
Asking the "shape set" app to do it (e.g., send a command to some IntentService), or
Using createPackageContext() and trying to do the copying from your main app
Or is there even another way of achieving what I want that I didn't think of?
Um, just use ZIP files that your app downloads itself from a well-known location. That corresponds to Dave Smith's final paragraph of his answer on the question you just linked to in your edit.
Or, just update the main app. I'm not quite certain what effort you think that you are saving otherwise.
Or, just keep the content online, using a Web service to indicate the available "shape sets" and downloading them as needed (with optional caching).
Fascinating question. If you really want to go for plug-ins then OSGi would probably be the way to go, but it's a lot of work to get to know and to use and seems like overkill in this case.
I don't know how your shapes are defined, but they are probably each defined in a separate file-set, providing the shape (maybe a png or jpg?) as well as the audio-file that will be used as a command for this shape. If the folder in which these file-sets are stored is fixed (TapGame/Shape Sets/...) the app could scan the folder each startup and the views could be generated accordingly (in this case, the activity cannot be build entirely in the XML-File, but must be partially done programmatically).
The Plugin-Aps would be rather easy. They are an apk which includes the file sets (jpg and mp3 or whatever). Started once they deposit all these files into the specified folder (they probably check before if these files exist) and then the apk can shut down again and be uninstalled.
on the next startup the Tap Game App would find the new symbols and include them into the game.
This seems rather straight forward to me. Another way would be to actually store the shapes and audio files on the internet and with each start of the App check if the number of shapes and audio-files has changed and create local copies of new ones. This would mean no downloads of apks... probably a more usual approach to the issue.
I am very interested to hear what you make of it, seems like a different approach then the norm, which is always cool to see.
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.
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.
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.
Is there a definitive method of creating either a PDF or a MS Word Doc file within the app and email it immediately (and possibly, also store it).
I have been trying for quite some time and have found out the JAVA libraries: apwlibrary and iText. But both of them dont provide any tutorials of sorts.
Could anyone point me in the right direction?
EDIT: Come to think of it, is could an online PDF generator be used, first by sending the data to the service, then retrieve the result and save it on the phone?
I would recommend apache fop http://xmlgraphics.apache.org/fop/
you can use standard FOP to generate pdf.
Unless it is a core feature of your device to create a pdf file I would suggest not to do it yourself. Adding PDF creation is going to be quite a lot of work potentially depending on your performance needs. Java libraries will be easier to add but less performant. Native libraries combined with Java will be more hazzle to maintain build and bug fixing wise.
If you just need to email some information why dont you create a message text in html and use a intent to email it with the build in email program instead? Or if you want you could e.g. put the PDF generation on a server and just email a link..
I'm working right now with JasperReports, an open source library to create reports in Java and export them to PDF, DOC, XLS... Using it in conjunction with iReport to create a group of templates makes it really easy to create files filled with content from different types of sources (I'm using JavaBeans).
If you don't like the idea of having static templates (That's a bit annoying depending on your needs), you can always take a look at DynamicJasper (The examples on the website are great).
Good Luck!
I have used Apache POI. It seemed to work well. http://poi.apache.org/
This actually, http://poi.apache.org/hwpf/