Intro and basic questions about extension development for Firefox on Android

Hi,

I really hope this question isn’t too broad. I know there’s documentation that would probably have answers, but not necessarily succinct or applicable ones.

So, I’m completely new to Firefox development and only motivated by my own desperate need.

My problem is that, afaik, no Android browser provides a bookmark export function. All rely on a variety of sync.

So, I need to write an extension to export bookmarks from the Firefox Android browser.

I don’t care if I’m the only person on the planet who uses it, so I’m not looking for advice on acceptance or distribution, just the most basic tools required to accomplish the task itself, on my own phone.

I had a quick look the problem a few months ago. I’ve forgotten the details but I recall it looked like it might be easier to copy bookmarks to the clipboard than save them to a file. If so, that would be completely acceptable. Also, I only need the contents of places.sqlite .

Maybe something like this already exists, in which case I’d welcome a link!

Any advice greatly appreciated!

Cheers,
bitrat

I was about to say, “this is gonna be a piece of cake to implement”, but actually now I see it’s not possible to do it at all.
Sadly, the Bookmarks API is missing completely in the Firefox for Android:

In any case, as you mentioned you can use Firefox Sync. to synchronize them with desktop and then export it from there.
Note that unlike other browser, Firefox Sync. is using E2E (end-to-end) encryption so all your data are encrypted before they are synchronized to Mozilla server, so not even they can see your bookmarks.

Plus it’s all opensource.

1 Like

Thanks juraj.masiar, it’s good to know, but disappointing… Unfortunately sync is completely useless to me.

Do you know why the bookmarks API is missing? Presumably the application itself has access. It seems almost deliberately obstructive, especially when the same tactic is being deployed by every other browser…

But, as you say, it’s open source! I’m sorely tempted to fork my own version, except I’ve never worked on any browser code and never done any Android development, ,

No time like the present I guess! :smiley:

Cheers,
bitrat

Don’t look for any conspiracy in this case :slight_smile:, the API is missing simply because it was not yet implemented.
Firefox dev. team (and especially the Android dev. team) is understaffed and things are moving forward sloooooooooooooowly.

BUT there is a good news! The API is planned and has a good priority P2:


So who knows, maybe even later this year!

Woohoo thankyou! That’s fantastic news!

I didn’t mean to cast suspicion on the hardworking devs… :#)

I was just working from my advantage of never having seen the source to determine that it would be trivial to implement. :smiley:

I remember I did some experimenting with the bookmarks API, as I mentioned, but I don’t remember what with… Javascript? I mean, what’s the minimal canonical approach to writing such an extension for desktop?

I’ve been thinking about a more intelligent bookmark manager for desktop and I’ve been using sqlite and python directly, but it would be nice to be able to use it from the browser…

1 Like

Yes, you’ll need some JavaScript skills to write an extension :slight_smile:.
The API should be pretty easy to use, just check the documentation I’ve linked before.

For example, this single call will get you the whole bookmarks tree:

But all depends on what you want to do with it. Implementing a bookmark manager is not gonna be easy at all :slight_smile:.

But implementing simple export should be, since all you need to do is serialize the tree into some text format (depending on your needs) and then download the result file - either by using official “downloads API” or some popular workaround (there is a few).

Hi, yep, pretty sure I already looked at exporting in my earlier experiments. After some archaeology, I see I hacked around with these examples: https://github.com/mdn/webextensions-examples

My bookmark ‘manager’ idea is more of a bookmark spider with some learning, probably not suited to running in a browser, but I’d like to integrate it, probably via an http api.

It’s not a priority though. Top of my list is exporting bookmarks from my phone!

I have a couple more questions:

Is the new ‘collections’ scheme a complete replacement for bookmarks (ie, is the entire ‘bookmarks’ system deprecated? wtf???).

Is there an equivalent for ‘about:config’ on the android browser, or any mechanism for installing a temporary extension?

Cheers,
bitrat

I think the purpose of collections was something else, but I can’t remember what. Maybe to store current session as a collection and continue it later on. Or even to switch between sessions.
I’ve tried to use it years ago but it had some issues (content was always cached and I had to reload each tab each time, or something like that).

Don’t worry, bookmarks are not going anywhere anytime soon (said by a guy whose main addon is basically a “bookmark replacement” :smiley:).

Regarding the about:config, you need Firefox Beta or Nightly for that, it’s disabled in Release channel in Android. Same applies for not-recommended addons, they are currently restricted to Beta and Nightly, but general support seems to be wip.

Here is the article for extensions development in Android:

It’s pretty hard to set it up first, but then it’s OK.

Thanks for this link. I did delve into Android development once before, and I discovered I don’t have much patience with it, but I’m inspired to have another look (unless I just root my phone and download places.sqlite). :smiley:

Also good to hear that about bookmarks. I think I read an old thread expressing a lot of sturm und drang over collections replacing them, but maybe it was a panic.