0

I am trying to download a file and then when opening it start an activity to process it.

The extension is .ofx. Firstly my browser won't download the file, which I am assuming is because it doesn't recognise the extension. If I download the file on my PC and copy it to my tablet I still can't get it to open my app.

If I change the extension to .csv it works fine, but not if I leave it as .ofx.

Is ofx a reserved extension somehow. The code is shown below

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
        android:scheme="file"
        android:mimeType="*/*"
        android:pathPattern=".*\\.csv" />
    <data
        android:scheme="file"
        android:mimeType="*/*"
        android:pathPattern=".*\\.ofx" />
</intent-filter>

The two file schemes are just to show the differences, even with just the ofx one it doesn't work. Strangely though even though the file is an OFX formatted file, the getIntent().getType() returns text/comma-separated-values. The first few lines of the OFX file are as follows if that is relevant.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?OFX OFXHEADER="200" VERSION="203" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>
<OFX>
    <SIGNONMSGSRSV1>
        <SONRS>
            <STATUS>
                <CODE>0</CODE>
                <SEVERITY>INFO</SEVERITY>
            </STATUS>
            <DTSERVER>20140429093807.875[+1]</DTSERVER>
            <LANGUAGE>ENG</LANGUAGE>
        </SONRS>
    </SIGNONMSGSRSV1>

Don't know what I am doing wrong, please help if you can.

PeterB
  • 95
  • 2
  • 9
  • No idea. But did you read: http://stackoverflow.com/questions/4799576/register-new-file-type-in-android – greenapps Apr 30 '14 at 10:21
  • Yes, I looked at every link I could find and tried it. Mostly they gave the same answer which puzzles me even more as to why mine doesn't work. – PeterB Apr 30 '14 at 10:51
  • You said " Firstly my browser won't download the file," What does it instead? – greenapps Apr 30 '14 at 16:08
  • As I said, I downloaded it to my PC and copied it to the tablet. – PeterB May 02 '14 at 07:53
  • No i asked what your browser did instead. Not what you did. – greenapps May 02 '14 at 09:57
  • Maybe your question should've been "What does it DO instead?" The browser says download failed – PeterB May 07 '14 at 07:14
  • Try different browsers. They all behave differently. – greenapps May 07 '14 at 07:53
  • But the problem isn't downloading it, as I have copied a file onto the tablet. The problem is associating the extension to my app. – PeterB May 09 '14 at 10:00
  • You wrote " the getIntent().getType() returns text/comma-separated-values. " At wich moment and where is that intent? I would believe when your activity gets started. How do you test? Which app do you use trying to launch your activity for an .ofx file? – greenapps May 09 '14 at 10:13
  • The comma_separated-values is return when I open a csv file. As you can see from the code I have registered the app to use csv. That seems to work fine, although that was only a test. I don't want to use csv. I want to use .ofx. They are OPEN FINANCIAL EXCHANGE files used by banks for statement data. All I want to do is log on to my bank, download the file and then after downloading I want to click on the file and open my app to process the file. – PeterB May 09 '14 at 16:54
  • But it won't download, with 2 browsers I have tried and when I forced a .ofx file onto my tablet and tried to open it in the File Manager it comes up with the error. ie no applications is known that will open the file. – PeterB May 09 '14 at 16:55
  • Try some other filemanagers also. I tried four browsers. One displayed the file (well rubbish of course) and one downloaded it zipped. You did not tell wich browsers you used. – greenapps May 09 '14 at 17:01

0 Answers0