Hey Bob. I agree, getting an example to compile is a good first step. Unfortunately we don't provide a version on github, but maybe we should.
We have an example project on github that uses Android Components which provides many reusable components on top of GeckoView [1] If you still want to build GeckoViewExample what you need to do is add a root build.gradle file like this one that specifies topobjdir: [2] change this line to refer to a released version of GeckoView: [3] e.g. "org.mozilla.geckoview:geckoview-nightly:78.0.20200505094621" and remove this line [4]. feel free to chat with us at https://chat.mozilla.org/#/room/#geckoview:mozilla.org Cheers, [1]: https://github.com/mozilla-mobile/reference-browser [2]: https://github.com/mozilla-mobile/gradle-apilint/blob/master/build.gradle [3]: https://searchfox.org/mozilla-central/rev/dc4560dcaafd79375b9411fdbbaaebb0a59a93ac/mobile/android/geckoview_example/build.gradle#56 [4]: https://searchfox.org/mozilla-central/rev/dc4560dcaafd79375b9411fdbbaaebb0a59a93ac/mobile/android/geckoview_example/build.gradle#5 On Wed, May 6, 2020 at 12:30 PM Bob Achgill <bobachg...@hotmail.com> wrote: > Thanks Agi! > > I will look through the Example. > > It would be good if i could get the Example to compile so i can see how > each feature looks. I could not find a GitHub version of the Example to > download... so i tried copying each activity, manifest, layout, and gradle > and recreating a AS project Example. But when I run it i get an error. > Doing all that by hand I probably missed something. > > If there is no better way to get a copy of the Example... can you suggest > what i may have missed by looking at the error? > > Caused by: groovy.lang.MissingPropertyException: Could not get unknown > property 'topobjdir' for project ':app' of type org.gradle.api.Project. > > Thanks! > Bob Achgill > > ------------------------------ > *From:* Agi Sferro <asfe...@mozilla.com> > *Sent:* Tuesday, May 5, 2020 12:09 PM > *To:* Bob Achgill <bobachg...@hotmail.com> > *Cc:* mobile-firefox-dev@mozilla.org <mobile-firefox-dev@mozilla.org> > *Subject:* Re: GeckoView to help kids continue to learn at home in > lockdown in developing countries > > > you're trying to create a GeckoRuntime > > This should read: you're trying to re-create a GeckoRuntime, in essence > you can only create the runtime in a given process once. When rotating > Android re-uses the process of your app and re-runs the initialization > code, causing the runtime to be created a second time. > > On Tue, May 5, 2020 at 10:07 AM Agi Sferro <asfe...@mozilla.com> wrote: > > Hi Bob, that's pretty cool! > > GeckoView should support Android 4.1 (API level 16) for all versions, > however we don't test on that version, so you might encounter bugs. > > The crash on rotation is probably due to the fact that you're trying to > create a GeckoRuntime in the same process, you can deal with this using a > static variable for the runtime, see [1]. > > GeckoViewExample (code linked above) supports tabs, you can get an idea > how to implement that from reading the code. In essence you would create a > `GeckoSession` for each tab and then call `geckoView.setSession(session)`, > see also [2]. > > [1]: > https://searchfox.org/mozilla-central/rev/7908ce29657cfd623993046bd8e38664e1c0b28e/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java#377 > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsearchfox.org%2Fmozilla-central%2Frev%2F7908ce29657cfd623993046bd8e38664e1c0b28e%2Fmobile%2Fandroid%2Fgeckoview_example%2Fsrc%2Fmain%2Fjava%2Forg%2Fmozilla%2Fgeckoview_example%2FGeckoViewActivity.java%23377&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866822115&sdata=WqoRRLrgJAQKUb5nVHdCBCvZhhtPmk5kVU21Br7EtCE%3D&reserved=0> > [2]: > https://searchfox.org/mozilla-central/rev/7908ce29657cfd623993046bd8e38664e1c0b28e/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java#1030-1041 > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsearchfox.org%2Fmozilla-central%2Frev%2F7908ce29657cfd623993046bd8e38664e1c0b28e%2Fmobile%2Fandroid%2Fgeckoview_example%2Fsrc%2Fmain%2Fjava%2Forg%2Fmozilla%2Fgeckoview_example%2FGeckoViewActivity.java%231030-1041&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866832105&sdata=%2FzbJsqN3XFad5lKUcef9D7V8mMilrp3ou6KvSUY5bbg%3D&reserved=0> > > On Tue, May 5, 2020 at 7:06 AM Bob Achgill <bobachg...@hotmail.com> wrote: > > Hello GeckoView developers/users, > > I am new to Java and GeckoView and have a few questions. My use case is > ... > There are presently 1.5 billion children out of school due to C19. > I am making a quick Geckoview app that they can use to continue to learn > from home on their family smart phone. Think Jelly Bean on up. > I already 1.8 GB mother tongue html video curriculums that we have been > using firefox for them to locally browse the curriculum. > Here is where GeckoView comes in... it will be much easier for families to > use an app integrated with the html viewing built in. > > Here are my hurdles to getting GV going in my app > 1) On both 70.0.20190712095934 and 77.0.20200421094220 my S7 GV crashes > when turning the phone between portrait and landscape. That seems like I > must be doing something really wrong with setting up the GV session? (see > my activity below) > > 2) I have some clients on 4.1. Is there a way of knowing which builds of > GV support which min SDKs? Is there a way to tweak GV to get down to > support 4.1? > > 3) What is the code I add to support tabs? Siblings in the same home then > can use their own tab view after brother does his homework with no > complaints. > > > Thanks so much! > Bob Achgill > > PS You can see from my code that I commented out lines in trying to set > up the settings. There is not much in the way of examples to follow that I > just didn't get AS giving me complaints on so i had to // them out. So > please feel free to add to my humble attempts! Your inputs will help kids > around the world start getting productive this week. :) > ~~~ > > package org.hishandsreader.mygeckoview; > > import androidx.appcompat.app.AppCompatActivity; > > import android.os.Bundle; > import android.view.View; > import android.view.WindowManager; > > // GeckoView > https://mozilla.github.io/geckoview/consumer/docs/geckoview-quick-start.html > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmozilla.github.io%2Fgeckoview%2Fconsumer%2Fdocs%2Fgeckoview-quick-start.html&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866832105&sdata=4QnpxhkZFkDvzDcnrM6OfGXd%2FsRXFAYH5Na7efH%2FRYI%3D&reserved=0> > import org.mozilla.geckoview.GeckoRuntime; > import org.mozilla.geckoview.GeckoRuntimeSettings; > import org.mozilla.geckoview.GeckoSession; > import org.mozilla.geckoview.GeckoSessionSettings; > import org.mozilla.geckoview.GeckoView; > > > > > > public class MainActivity extends AppCompatActivity { > > private GeckoView geckoview; > private GeckoSession geckoSession; > private GeckoRuntime geckoRuntime; > // test > private boolean mCanGoBack; > > @Override > protected void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.activity_main); > > // GeckoView > https://mozilla.github.io/geckoview/consumer/docs/geckoview-quick-start.html > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmozilla.github.io%2Fgeckoview%2Fconsumer%2Fdocs%2Fgeckoview-quick-start.html&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866842100&sdata=XEzA9kroKvEsfo5XnpkpHGERFlsWW1UQOiIWlruSZyc%3D&reserved=0> > GeckoView view = findViewById(R.id.geckoview); > > geckoSession = new GeckoSession(); > > //geckoSession.getSettings().setBoolean(GeckoSessionSetttings.USE_MULTIPROCESS, > true); > > //geckoSession.getSettings().setBoolean(GeckoSessionSetttings.USE_DESKTOP_MODE, > false); > > GeckoRuntimeSettings.Builder builder = new > GeckoRuntimeSettings.Builder() > .javaScriptEnabled(true) > //// .nativeCrashReportingEnabled(true) > .consoleOutput(true); > > geckoRuntime = GeckoRuntime.create(MainActivity.this, > builder.build()); > > ////geckoview.setSession(geckoSession geckoRuntime); > > geckoSession.open(geckoRuntime); > view.setSession(geckoSession); > > > //geckoSession.loadUri( "https://exploitrme.wordpress.com/ > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fexploitrme.wordpress.com%2F&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866842100&sdata=oxDYpXdJplSBYK5CogDxhxhYrKJ1fqpwKtdRbtelWSI%3D&reserved=0> > "); > > //https://github.com/mozilla-mobile/android-components/issues/5968 > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmozilla-mobile%2Fandroid-components%2Fissues%2F5968&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866852096&sdata=9ojDHx1YiueOmIyebyEqWHwgZgr1jE4F%2B8nZUW2e6Ys%3D&reserved=0> > > geckoSession.loadUri("resource://android/assets/www/HHR-Learn2Read.html"); > //TODO Pixel api 19 never online > //TODO Pixl 29 shows app but no html > //TODO Bobs S7 works!! Backbutton works! > //TODO get help try to understand this to sper backbutton? > https://qiita.com/YusukeIwaki/items/3c25f7b73650c87180ba > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fqiita.com%2FYusukeIwaki%2Fitems%2F3c25f7b73650c87180ba&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866852096&sdata=fLCQnyYKZl5YCtocl6pvT0%2FRo%2BP%2B4uXyOxv2nrIpI%2Bg%3D&reserved=0> > > // In Japanese > https://qiita.com/YusukeIwaki/items/3c25f7b73650c87180ba > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fqiita.com%2FYusukeIwaki%2Fitems%2F3c25f7b73650c87180ba&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866852096&sdata=fLCQnyYKZl5YCtocl6pvT0%2FRo%2BP%2B4uXyOxv2nrIpI%2Bg%3D&reserved=0> > // @Override > //public void onBackPressed() > //{ > // session.goBack(); > //} > > > } > > @Override > public void onBackPressed() { > //if (geckoSession.canGoBack()) { > geckoSession.goBack(); > //} else { > // super.onBackPressed(); > //} > } > > > > // Does not appear to be doing anything. > public void onFullScreen(GeckoSession geckoSession, boolean > fullScreen) { > if (fullScreen) { > > getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); > > getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE > | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION > | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN > | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION > | View.SYSTEM_UI_FLAG_FULLSCREEN > | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); > } else { > > getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); > > getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE > | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); > geckoSession.exitFullScreen(); > } > } > } > > > _______________________________________________ > mobile-firefox-dev mailing list > mobile-firefox-dev@mozilla.org > https://mail.mozilla.org/listinfo/mobile-firefox-dev > <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.mozilla.org%2Flistinfo%2Fmobile-firefox-dev&data=02%7C01%7C%7C317c713cdb3a4019551508d7f1171c7a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637242953866862088&sdata=VaiwCoaxAcejl5SzZb35IwrlxZXQWdl%2BiFylKylVbJ8%3D&reserved=0> > >
_______________________________________________ mobile-firefox-dev mailing list mobile-firefox-dev@mozilla.org https://mail.mozilla.org/listinfo/mobile-firefox-dev