Coder Social home page Coder Social logo

cordova-sharingreceptor's Introduction

cordova-sharingreceptor

A cordova plugin that permits to receive data sent from other applications (like urls, images...) It handles cases where app is started or resumed.

This is for doc purpose, you should customize this plugin for your needs because currently I only made it work to share browser urls (like a clipper)

For iOS, it is harder but achievable!

Usage:

cordova.SharingReceptor.listen(function(data) {
    // do something
});

Android

Listens for data of intents SEND / SEND_MULIPLE. Intent filters have been set to receive data of any mime type (better solution exists?)

The data contains the intent name and the intent extras.

Here is an example of data that is send when sharing a web page with Chrome:

{  
   "intent":{  
      "action":"android.intent.action.SEND",
      "extras":{  
         "android.intent.extra.TEXT":"http:\/\/www.conforama.fr\/",
         "android.intent.extra.SUBJECT":"Meuble, cuisine, décoration, électroménager, image et son, informatique : Conforama, c'est bon de changer - Conforama"
      }
   },
   "platform":"android"
}

Notes

It is initially inspired by (cordova-webintent)[https://github.com/Initsogar/cordova-webintent] plugin but simpler. This Android-only plugin is now unmaintained and has a larger goal than this plugin.

Licence: MIT

cordova-sharingreceptor's People

Contributors

slorber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cordova-sharingreceptor's Issues

installListener exception after WebView navigation

I'm trying to integrate this plugin into Rocket.Chat Cordova, and it works great in a simple use case, but whenever the app navigates to a new local URL upon switching chat servers, this plugin throws an exception and stops processing events.

Firstly, I think onReset should remove the current listener so that a new page can install a new one, as I think this should be expected.

Secondly, there seems to be a bug with the Crosswalk WebView they are using where it does not raise onReset when a plugin callback triggers the navigation, so I'm thinking adding support for manually replacing the listener could be a good workaround - an alternate action for execute that just clears the current listener. (I've filed a bug report with Crosswalk, but who knows when/if that will be fixed.)

Alternately, installListener could just unconditionally replace the listener whenever it is called and not worry about it. This is the simplest fix, depending on how you feel this condition should be handled.

Note: depending on what changes you're cool with, I'll happily submit a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.