Search code examples
androidfirefoxfirefox-addonfirefox-addon-sdk

How to set icon for pageaction in firefox android extension


I use PageActions to create address bar button in adnroid ff addon https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/PageActions.jsm.

And I have icon.png in main directory of addon project. Example of my PageAction:

PageActions.add({
   icon: "icon.png",
   title: "My page action",
   clickCallback: function () {
   showAlertDlg('myaddon', 'action');
   }
 });

But button create without icon. How correctly set icon to my pageaction?


Solution

  • I found solution: -Create in main project folder skin/icon.png -Create chrome.manifest with content: content my-addon content/ skin my-addon classic/1.0 skin/ -Use icon as:

    uuid = PageActions.add({
        icon: "chrome://my-addon/skin/icon.png",
        title: "My page action",
        clickCallback: function () {
        }
    });
    

    Problem was that I wrote icon: "chrome://skin/icon.png" without addon name "my-addon" in path