• Skip to main content
  • Select language
  • Skip to search
mozilla
Mozilla Developer Network
  • Sign in
    • Persona
    • GitHub
  • Web Platform
    Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • APIs / DOM
    • Apps
    • MathML
    References & Guides
    • Learn the Web
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • ...more docs
  • Mozilla Docs
    • Add-ons
    • Firefox
    • Firefox Marketplace
    • Firefox OS
    • Persona
  • Developer Tools
  • Feedback
    • Get Firefox help
    • Get web development help
    • Join the MDN community
    • Report a content problem
    • Report a bug
  •  
B2G OS
    • Español
    • Add a translation
  • Edit
  • Advanced
    • History
    • Print this article
  1. MDN
  2. Mozilla
  3. B2G OS
  4. Firefox OS APIs
  5. MozActivity
Your Search Results

    MozActivity

    In This Article
    1. Summary
    2. Constructor
    3. Properties
    4. Methods
    5. Example
    6. Specification
    7. See also
    8. Browser compatibility

    This API is available on Firefox or Firefox OS for installed or higher privileged applications.

    Summary

    The MozActivity interface allows apps to delegate an activity to another app.

    This interface fully inherits from the DOMRequest interface except that it has a constructor that it takes a MozActivityOptions as a parameter.

    Note: As soon as a MozActivity is instantiated, the system will prompt the user to choose an activity handler. It's not possible to instantiate an activity and wait to use it.

    Constructor

    new MozActivity( options )
    options
    An object that has the same properties as the ones define in the MozActivityOptions interface.

    Properties

    Inherited from DOMRequest:

    DOMRequest.onsuccess
    A callback handler called when the operation represented by the DOMRequest is completed.
    DOMRequest.onerror
    A callback handler that gets called when an error occurs while processing the operation.
    DOMRequest.readyState
    A string indicating whether or not the operation is finished running. Its value is either "done" or "pending".
    DOMRequest.result
    The operation's result.
    DOMRequest.error
    Error information, if any.

    Methods

    None.

    Example

    var activity = new MozActivity({
      // The name of the activity the app wants to delegate the action
      name: "pick",
    
      // Data required by the activity. Each application acting as an activity handler 
      // can have it's own requirement for the activity. If the data does not fulfill
      // all the requirement of any activity handler, the error event will be sent
      // otherwise, the event sent depend on the activity handler itself.
      data: {
        type: "image/jpeg"
      }
    });
    
    activity.onsuccess = function() {
      console.log("Activity successfuly handled");
    
      var imgSrc = this.result.blob;
    }
    
    activity.onerror = function() {
      console.log("The activity encouter en error: " + this.error);
    }

    Specification

    Web Activities is not part of any specification. However, it has some overlap with the proposed Web Intents specification. Mozilla actually proposed Web Activities as a counter proposal to Web Intents. For more information about this, see discussion on the Web Intents Task Force ML.

    See also

    • DOMRequest
    • MozActivityOptions
    • Web Activities

    Browser compatibility

    • Desktop
    • Mobile
    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    basic support No support No support No support No support No support
    Feature Android Chrome for Android Firefox OS Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    basic support No support No support (Yes) 32.0 (32.0)[1] No support No support No support

    [1] WebRT only

    Share:
    • Twitter
    • Facebook
    • Google+

    Document Tags and Contributors

    Tags: 
    • API
    • B2G
    • Firefox OS
    • Non-standard
    • Web Activities
     Contributors to this page: chrisdavidmills, Sebastianz, fscholz, MHasan, carlosdp, jdover, vishu_gawli, justinpotts, ethertank, Sheppy, teoli, Jeremie, mounirlamouri, robhudson
     Last updated by: chrisdavidmills, Feb 11, 2016, 4:01:21 AM
    See also
    1. Web Activities
    2. MozActivity
    3. Inheritance:
      1. DOMRequest
      2. EventTarget
    4. Related pages for Web Activities
      1. MozActivityOptions
      2. MozActivityRequestHandler
      3. Navigator.mozSetMessageHandler()

    © 2005-2016 Mozilla Developer Network and individual contributors.

    Content is available under these licenses.

    • About MDN
    • Terms
    • Privacy
    • Cookies
    • Contribute to the code

    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy