-
Notifications
You must be signed in to change notification settings - Fork 558
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
base: master
Are you sure you want to change the base?
Conversation
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.
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 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. |
You yourself usually don't use the "Suggest a change" functionality but make the changes in your codebase directly. |
Applied suggested formatting changes
Applied the changes and thanks for getting me ramped up with the flow here. |
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- User has a native app AND a working cordova app that needs to be integrated. (Described here)
- 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 :-)
There was a problem hiding this comment.
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>
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still apply?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
There was a problem hiding this comment.
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
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. |
@dpogue That would probably replace the first two steps... no need to copy any files around, right? |
I believe that would be true, but I've never tried it. |
This sounds interesting but I have never stumbled across it. I'll get back here if I have an update on this. |
Hey @martinhorvath, did you ever find the time to try getting Cordova Android from bintray? |
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.