Skip to content

open a file or url in an external app, trigger android.intent.action.VIEW|SEND #153

Open
android-js/android-native-apis
#15
@PawelSuwinski

Description

@PawelSuwinski

Hi

It could be nice feature apart to app.loadURL() to have also possibility to send to or view resource externally using android built-in app chooser having something like app.sendURL()|app.viewURL().

For now I do it on back process level by spawning ActivityManager process:

// view/index.html
document.querySelectorAll('#upload a').forEach(a => a.addEventListener('click', e => { 
  e.preventDefault();
  front.send('view', e.target.href);
})));
// main.js
back.on('view', file => require('child_process').execFile('am',
  [...'start --user 0 -a android.intent.action.VIEW -d'.split(' '), file],
  err => err && back.send('error', err)));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions