importing csv file to launch android app - java

My project has features to export and import csv file into my application
I have successfully completed export csv file into gmail. I can see the attached file in my gmail inbox.
-Now I want to import the file to my app . On click I need to launch my app and in my second activity I need to perform read from the csv file and add the contents to db.
I wish to ask 2 ways of achieving it.
Is it possible to long press the attachment csv file in my gmail inbox and show my app in the launch list. ( like in IOS ).
If its not possible, then i will download the csv file to my storage. Then from the File Manager folder, I want to use long press -> share via feature.
I want to show my app in the share via feature list.
Upon click , it will launch my app and in my second activity I need to add the implementation of reading the csv file contents row by row and adding to DB.
Let me know how to achieve either 1 or 2 options.
I tried settings action send and category default with mimetype text/csv.
But i cannot see my app in the launcher list.

There is your answer:
https://stackoverflow.com/a/5097734/3703819
use pathPattern: ".*\\.csv"

Related

How to download file from a "Download" folder using postman or API

In my application, after clicking export icon, the report excel has been downloaded/generated in our local download folder in the system. I have tried to validate this action using service side (API)-postman. When I hit the export api (Application specific) , the response has not contain any path/file name that downloaded in the downloads folder. Is there any way that we can hit the downloads folder using api or any java programming way to get the downloaded excel.
I just want to read the excel data and compare with my input data using postman. First priority that I need to do it using api.
Select "Send and download" action in Postman. According to manual here:
If your API endpoint returns an image, Postman will detect and render
it automatically. For binary response types, you should select “Send
and download” which will let you save the response to your hard disk.
You can then view it using the appropriate viewer. This gives you the
flexibility to test audio files, PDFs, zip files, or anything that the
API throws at you.

Unable to read file using FileProvider

I have multiple apps that take photos and store them on external storage.
I want to upload the photos along with some metadata to a web application running on my companies server.
I am able to write data and file URI to a database using a ContentProvider.
I have written a SyncAdapter to upload the files via HTTP-POST, but I am stuck because in this SyncAdapter I cannot get permission to read the files.
My big question is: Can I use a FileProvider to overcome this issue?
I am NOT storing the files in the ContentProvider using an intent.
I have tried to set permissions on URL, it failed.
I Desperation I tried to export the FileProvider, which was not allowed.
I want to be able to open an input-stream of the file in another app than the one storing the file without having to start the transfer using an Intent.

How to return a file in web application using Tapestry

I am working on a web application of Data Compression Library. What it does is that it takes an Input file and downloads it on localhost for processing. Downloading is done by using the UploadedFile service of tapestry. After taking this file, a C++ executable is invoked when the form is submitted in the browser. The output of the C++ program is the compressed file that is generated in the same directory as of the downloaded original file. Now what I have to do is, to make the compressed file available for download for the user. I am redirecting the user to another page after the form is filled.
The same goes for decompression, i.e, a form is filled in which file is selected and the file is downloaded to localhost. Decompression is performed via the C++ program and file is generated. User is redirected to another page.
How do I make this file available for download? It should be like a button is displayed and when the user clicks on it, the Save File as pop up should be displayed.
On Java side, just implement an event handler (maybe associated to click events on the download button displayed) returning an instance of the org.apache.tapestry5.StreamResponse interface.
You can find some examples on Tapestry's wiki: https://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile.

Where and how does GAE blobstore stores a file (or blob)?

I am new to Google App Engine. I ran (locally) the sample of GAE bolbstore application given in the below link:
https://developers.google.com/appengine/docs/java/blobstore/
It launched a page to choose and submit a file. When I choose a file clicked the submit button:
i) the browser automatically downloads the same file. Why is it again downloading the same file?
ii) it created two files inside the folder 'appengine-generated'. They are:
d06-XwWoSZVw9HRcnLjZiA
local_db.bin
What are these files and where did my file store as blob?
Don't worry too much about what happens locally on the dev server.
i) It's just part of the demo, it serves you back the file you just uploaded because of this line:
res.sendRedirect("/serve?blob-key=" + blobKey.getKeyString());
ii) The first would I guess be the file you've just uploaded, the second would be the local copy of mySQL the dev server is using to emulate the datastore itself. Try comparing sizes to the original file you uploaded?
Once you have stored the file you have to access it via the api's provided, what form and where the file is actually stored no longer matters.

Android File Association

How do I have a new file type launch my app?
For example if I have a new file type 'file.mjl' and I receive this file as an email, I want Android to associate this file type with my app and allow me to open / save it.
You need to add an intent-filter to the activity you want to launch to work with that file. Here is a link to a great example on that subject:
https://developer.android.com/guide/topics/intents/intents-filters.html

Categories