Vitalii Sky
Vitalii Sky

Reputation: 133

Don't work plugins ChildBrowser with Phonegap 1.9.0

Don't work plugins ChildBrowser (https://github.com/phonegap/phonegap-plugins/tree/master/Android/ChildBrowser) with Phonegap 1.9.0 (using android version). There are some errors in ChildBrowser.java. javascript write that window.plugins is deprecated.

Have some one any ideas? Thanks.

Upvotes: 1

Views: 2185

Answers (2)

Simon MacDonald
Simon MacDonald

Reputation: 23273

I had posted up an upgraded ChildBrowser.java that works with 1.9.0 to my Dropbox account. I haven't pushed the changes to github as I want to make it so that in 2.0.0 you don't need to update your plugins src code just to have them work in the latest version of PG. I hope to check in that change before 2.0.0 is released so we can all move forward with good instructions on how to upgrade your plugins.

Just as a follow up, here is my blog post on the kerfuffle.

http://simonmacdonald.blogspot.ca/2012/07/phonegap-android-plugins-sometimes-we.html

Upvotes: 5

dhaval
dhaval

Reputation: 7659

I did manage to make it work with Cordova 1.9.0 with few changes in the ChildBrowser.java file.

Changes I have done:

  • ctx.getContext() replaced with ctx.getActivity().getApplicationContext()
  • ctx.startActivity() replaced with ctx.getActivity().startActivity()
  • ctx.getSystemService() replaced with ctx.getActivity().getSystemService()
  • ctx.getAssets() replaced with ctx.getActivity().getAssets()
  • ctx.runOnUiThread() replaced with ctx.getActivity().runOnUiThread()
  • new Dialog(ctx.getContext(), android.R.style.Theme_NoTitleBar) replaced with new Dialog(ctx.getActivity(), android.R.style.Theme_NoTitleBar)

I have not tested aggressively but it does work with basic tests. I might have replaced something wrong or missed anything but the above changes are working fine.

Full source at - https://gist.github.com/3085079

I have tested with Cordova 1.9 on Android 2.2

Upvotes: 2

Related Questions