Headless Chromium using Android Studio as a C++ library. How to build and integrate ?

856 views
Skip to first unread message

srini...@gmail.com

unread,
Nov 29, 2017, 4:16:14 PM11/29/17
to headless-dev
Hi Team,
Looking for notes to build and integrate Headless Chromium using Android Studio as a C++ library.
I hope its possible. If yes, please share link or wiki.

Thanks,
Srini

Srini Ananthakrishnan

unread,
Nov 30, 2017, 2:39:50 PM11/30/17
to headless-dev
I guess I'm looking for Embedder API integration and examples using Android Studio.
Can someone please provide some pointers ? Is this supported ?

Using below link as reference:
https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

da...@chromium.org

unread,
Nov 30, 2017, 6:34:43 PM11/30/17
to headless-dev
Hi Srini,

I think you want to follow the example in the headless_shell: https://cs.chromium.org/chromium/src/headless/app/  It's pretty much embedding the headless chrome as a C++ library into a console app.

Not sure what exactly you mean by "using Android Studio" though. I'd guess the answer is "as any other C++ library" maybe? Any specific issues with headless?

Cheers!

Srini Ananthakrishnan

unread,
Nov 30, 2017, 7:10:52 PM11/30/17
to headless-dev
Hi da,
Thanks for responding. I wanted to invoke headless lib from my app via JNI. So was thinking to integrate headless as native library...but soon realized dependencies are too much. What is the best way to go about a) try build as ndk pre-built library b) as native library c) any other method ?

Srini

dvallet (Chromium)

unread,
Nov 30, 2017, 7:31:07 PM11/30/17
to Srini Ananthakrishnan, headless-dev
The target headless_shell_lib should create a library that you can link to (that's what headless_shell and headless_example uses). This library should contain all (chrome) dependencies, so in theory you could invoke it through JNI, I think.

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/153dc751-28ab-445d-9045-688db52e44b3%40chromium.org.

Srini Ananthakrishnan

unread,
Nov 30, 2017, 7:33:29 PM11/30/17
to headless-dev, srini...@gmail.com
Thanks. Will give it a try.

Eric Seckler

unread,
Dec 1, 2017, 2:38:01 AM12/1/17
to Srini Ananthakrishnan, headless-dev

Depending on your use case, and provided you're targeting only Android, a possible alternative option might be to rely on the system's WebView component, e.g. embed it as a hidden view and then use devtools to talk to it. Could be easier (and much more lightweight) than embedding headless into an Android app, since WebView is already present on the device.


Srini Ananthakrishnan

unread,
Dec 1, 2017, 11:58:27 AM12/1/17
to Eric Seckler, headless-dev
Nice suggestions..will evaluate that too..

Thanks,
Srini

Sami Kyostila

unread,
Dec 4, 2017, 5:27:54 AM12/4/17
to Srini Ananthakrishnan, Eric Seckler, headless-dev
Right, I would also suggest looking into WebView because 1) it is automatically kept up-to-date and 2) Headless Shell hasn't been ported to Android yet.

- Sami

ryanyo...@gmail.com

unread,
Apr 6, 2018, 3:20:25 PM4/6/18
to headless-dev
I think Srini meant was, does this work in android applications. I am interested if this software is supported with android myself.

bes...@gmail.com

unread,
Apr 28, 2019, 7:36:24 PM4/28/19
to headless-dev, ryanyo...@gmail.com
No reply Since 2018 , i am interested , can we use this with android ?

Sami Kyostila

unread,
Apr 29, 2019, 1:17:54 PM4/29/19
to bes...@gmail.com, headless-dev, ryanyo...@gmail.com
We do not support Headless Chromium on Android. Android WebView might be a possible solution however.

- Sami

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.

bes...@gmail.com

unread,
May 2, 2019, 1:02:56 PM5/2/19
to headless-dev
Android WebView is a great option but you can not call it when the app in the background. or via background service. once your application goes to the background, or the phone is locked, then your app is paused with all UI.
As you know, Android WebView is a UI Thread.

Base on your experience, how can I use AndroidWEBView form a background service?
I have a website and I want to load one page on WebView, and once the mobile is locked, I need to reload the webView and inject javascript to get DOM results on each 60 sec.

Can we do such a thing in android

vna...@gmail.com

unread,
Apr 16, 2020, 1:04:39 PM4/16/20
to headless-dev, bes...@gmail.com
I've been at it for weeks, and so far I haven't found a solution.. please help me
Reply all
Reply to author
Forward
0 new messages