It is a very simple case because just that instruction has to be put in the
start() method of any test app with
codename1.arg.android.xintent_filter=<intent-filter><action
android\:name\="android.intent.action.SEND" /><action
android\:name\="android.intent.action.VIEW" /><action
android\:name\="android.intent.action.PICK" /><category
android\:name\="android.intent.category.DEFAULT" /><category
android\:name\="android.intent.category.BROWSABLE" /><category
android\:name\="android.intent.category.OPENABLE" /><data
android\:scheme\="file" /><data android\:scheme\="content" /><data
android\:mimeType\="*/*" /></intent-filter>
public void start() {
String arg=Display.getInstance().getProperty("AppArg",null);
System.out.println("arg="+arg);
if(current != null){
current.show();
return;
}
...
...
I sent the Android build, I do not think it is safe to attach the apk here.
You can easily do the same.
Then put a file into the Download folder and open it with some file-manager
app.
Regards
Il giorno mercoledì 10 febbraio 2021 alle 03:10:54 UTC+1 Shai Almog ha
scritto:
> Can you isolate this to a test case in the issue tracker so we can have a
> look?
>
> On Tuesday, February 9, 2021 at 4:53:50 PM UTC+2 P5music wrote:
>
>> The method is called once, and then the url is null when it gets to the
>> application, I think that
>>
>> String arg=Display.getInstance().getProperty("AppArg",null);
>>
>> gives the exception, then yields null.
>>
>> Regards
>>
>>
>>
>> Il giorno lunedì 8 febbraio 2021 alle 03:29:25 UTC+1 Shai Almog ha
>> scritto:
>>
>>> And the URL is just the unmodified apparg value or do you cache the
>>> value?
>>> Is it possible the method is invoked more than once?
>>>
>>> On Sunday, February 7, 2021 at 7:27:15 PM UTC+2 P5music wrote:
>>>
>>>> The following method is called:
>>>>
>>>> public static String readTextFileFromUrl(String url) throws IOException
>>>> {
>>>>
>>>> try(InputStream is =
>>>> FileSystemStorage.getInstance().openInputStream(url);) {
>>>>
>>>> InputStreamReader br = new InputStreamReader(is);
>>>>
>>>> int numChars=is.available();
>>>>
>>>> char[] b=new char[numChars];
>>>>
>>>> br.read(b, 0,numChars);
>>>>
>>>> br.close();
>>>>
>>>> return new String(b);
>>>>
>>>> } catch(IOException err) {
>>>>
>>>> String error=err.getMessage();
>>>>
>>>> System.out.println("write exc "+error);
>>>>
>>>> }
>>>>
>>>> return null;
>>>>
>>>> }
>>>>
>>>> Il giorno domenica 7 febbraio 2021 alle 03:14:46 UTC+1 Shai Almog ha
>>>> scritto:
>>>>
>>>>> Share intent on Android doesn't provide download folder access. It
>>>>> gives you a local URL to give you access to the file on your app without
>>>>> giving you access to all the downloaded files within the folder. So the
>>>>> URL
>>>>> should be fine. Not sure why it won't open though, How did you open that
>>>>> file?
>>>>>
>>>>> On Saturday, February 6, 2021 at 3:04:15 PM UTC+2 P5music wrote:
>>>>>
>>>>>> I am trying to check my CodenameOne app on Android device.
>>>>>> The file read/write permission seems to have some problems. The user
>>>>>> is asked about it at installation, but it does not seem to become
>>>>>> effective
>>>>>> for the app (some basic files are not saved on filesystem, exception is
>>>>>> thrown)
>>>>>>
>>>>>> I know that my app is not developed to handle file write on Android
>>>>>> device. I do not mind.
>>>>>>
>>>>>> But
>>>>>> I am testing the file opening from the filesystem (AppArg).
>>>>>>
>>>>>> When the user selects a file with .ext extension (alias for the file
>>>>>> type handled by the app)
>>>>>> from the Download folder
>>>>>> I see in logcat:
>>>>>>
>>>>>> System.err: java.io.FileNotFoundException:
>>>>>> file:/data/user/0/com.myapp.app/files/myfile.ext: open failed: ENOENT
>>>>>> (No
>>>>>> such file or directory)
>>>>>>
>>>>>> (and the app seems blocked, two "activity" screens are in the "recent
>>>>>> apps")
>>>>>>
>>>>>> It is strange because it does not seem that the url path is from the
>>>>>> Download folder.
>>>>>> The app is trying to open the url from AppArg.
>>>>>>
>>>>>> What's wrong?
>>>>>>
>>>>>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/adffccbb-433d-448c-ba06-141f9cc58313n%40googlegroups.com.