Skip to content

Android: Display.execute(url) requires unnecessary WRITE_EXTERNAL_STORAGE permission #2079

Closed
@jaanushansen

Description

@jaanushansen

It turns out, that Display.getInstance().execute(url) is not working correctly for url open Android 6.0+.

When the following code is run:

        button.addActionListener(new ActionListener<ActionEvent>() {

			@Override
			public void actionPerformed(ActionEvent evt) {
				Display.getInstance().execute("https://www.codenameone.com");
			}
        	
		});

Then app asks for media permission (which is not needed for simple urls):
permission_request

The problem reason seems to be, that in https://github.com/codenameone/CodenameOne/blob/master/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java createIntentForURL method has this code:

        if (url.startsWith("intent")) {
            intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
        } else {
            if(!checkForPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, "This is required to open the file")){
                return null;
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions