WebAPI: WebActivities
In this post, we will take a quick look at the WebActivity API. WebActivities are basically parts of apps that register with the system. When a user wants to perform a certain action that many apps can accomplish (like share, choose an image, take a photo, etc), the system will present the user with all the registered applications that can accomplish that action.
Starting an Activity
In order to launch one of these activities we create a MozActivity. The parameter is an object with the following
name: the name of the action the user wants to performdata: information about the action. Usually containstype
Here is a list of all the activities that Gaia offers. Let’s try to show the user an activity to create a contact. It’s done as follows
var activity = new MozActivity({
name: "new",
data: {
type: "webcontacts/contact"
}
});
activity.onsuccess = function() {
console.log("WebActivity reported success");
};
activity.onerror = function() {
console.log(this.error);
};
And that’s it! You can try the demo but the WebActivity API is not supported by any web browser. Source code is here.
Recent Blog Posts
- 14 Jun 2026 Almost realtime deploy logs in my SaaS
- 08 Jun 2026 The long list of bad decisions I made for my new SaaS
- 13 Apr 2026 Your intuition of LLM token usage might be wrong
- 11 Feb 2026 Locust Load Testing and Markov Chains
- 20 Jan 2026 I love the old man minimap in VS Code
- 03 Jan 2026 On Resurrecting a 12 year old blog
- 09 Oct 2014 Updating a forked Git repo
- 06 Oct 2014 ADB access to remote server from local usb
- 30 Mar 2014 Bug Progress: Day 2
- 27 Mar 2014 Building the Emulator