Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android WebViews documentation update #904

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

martinhorvath
Copy link

Platforms affected

Android

What does this PR do?

Update outdated documentation

What testing has been done on this change?

--

The web is full with outdated documentation and I wanted to share my findings with the community. This should be considered as a quick fix.

This update is based on my current findings while embedding a Cordova app into a native Android app.
The documentation of embedding cordova in native apps is outdated and this updated is considered as a quick update.
@janpio
Copy link
Member

janpio commented Nov 13, 2018

I suggested some changes, you can either accept these here in the GitHub UI (Don't just resolve the conversation, you have to accept the changes which will create a new commit to your patch-1 branch) or apply them manually on your local copy of poatch-1 and push that up to Github and it will appear here automatically.

Some stuff I just commented in a more general way, here you have to make the suggestions manually in your branch and push it up to Github.

@janpio
Copy link
Member

janpio commented Nov 13, 2018

You yourself usually don't use the "Suggest a change" functionality but make the changes in your codebase directly.

@martinhorvath
Copy link
Author

Applied the changes and thanks for getting me ramped up with the flow here.

@janpio
Copy link
Member

janpio commented Nov 13, 2018

You learned something for life now - I expect lots of future PRs from you :)

public ExecutorService getThreadPool() {
return threadPool;
}
1. Follow the instructions here to build your first cordova app [CreateYourFirstApp](https://cordova.apache.org/docs/en/8.x/guide/cli/index.html)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does one do that? Just to get the files to your harddisk from where you can copy them?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My interpretation (and use case) was to embed a cordova app into another Android app that was developed with native code. As this is a getting started documentation, I assumed it's a good starting point to build a first app. Everyone having a working cordova app by hand will obviously skip the step. Does this make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost. What do you need the Cordova app for when actually embedding the Cordova Android webview in the native app?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of my customers has the requirement to develop two native apps within a larger project. He also needs to have geospatial capabilities (like Google maps) but without the restrictions of the popular SDK's provided by Mapbox, Google,... The organization that will be offering the apps has licenses for the "Hexagon Mapworks SDK". But this is more a ready-to-use app than a SDK so I needed to run it within the native target app.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I get that. You have a native app and want a Cordova webview inside that can run a web app.

My question is more about this process you describe here: Why do you need an actual Cordova app created with cordova create to start the embedding process in the native app?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I've seen and learned is that the cordova build applies some magic to the html sources when copying them into the platform(s). I didn't look into this further but without a build for android, no assets/www sources are available.
The same applies to all other files and folders as only the full cordova build (cordova create + cordova add platform + cordova build) creates the android project sources.

So the scenario(s) are two different ones:

  1. User has a native app AND a working cordova app that needs to be integrated. (Described here)
  2. User has nothing, wants to create a cordova app and then do some native work in the app

With two different starting points, it's quite difficult to described it in general :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - I have never build an app that uses Cordova in that way at all, that's why I am asking such dumb questions.

Co-Authored-By: martinhorvath <martin.horvath@primebird.com>
janpio and others added 3 commits November 13, 2018 18:08
Co-Authored-By: martinhorvath <martin.horvath@primebird.com>
Co-Authored-By: martinhorvath <martin.horvath@primebird.com>
Co-Authored-By: martinhorvath <martin.horvath@primebird.com>
cwv.loadUrl(Config.getStartUrl());
}

1. If the application needs to use the camera, implement the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still apply?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config.getStartUrl() is marked as deprecated and has changed. I didn't touch the camera but assume it has changed as well.

}
}

1. Finally, remember to add the thread pool, otherwise plugins
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, not sure if this still applicable. I can look into this when I work on the plugin for the native-to-cordova-bridge

@dpogue
Copy link
Member

dpogue commented Nov 13, 2018

Not sure where exactly this belongs, but if you're wanting to just pull cordova-android as a framework into an existing app, it's published to Bintray as a library that you can pull in via gradle.
I suspect that option is completely missing from the documentation 😅

@janpio
Copy link
Member

janpio commented Nov 13, 2018

@dpogue That would probably replace the first two steps... no need to copy any files around, right?

@dpogue
Copy link
Member

dpogue commented Nov 13, 2018

I believe that would be true, but I've never tried it.

@martinhorvath
Copy link
Author

This sounds interesting but I have never stumbled across it. I'll get back here if I have an update on this.

@janpio
Copy link
Member

janpio commented Mar 1, 2019

Hey @martinhorvath, did you ever find the time to try getting Cordova Android from bintray?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants