1

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.

Vitalii Sky
  • 133
  • 1
  • 2
  • 9

2 Answers2

5

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

Simon MacDonald
  • 23,253
  • 5
  • 58
  • 74
2

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

dhaval
  • 7,611
  • 3
  • 29
  • 38
  • 1
    bhai In first one only `ctx` is enough, instead of `ctx.getContext()` :)..Although +1 for such details.... – coderslay Jul 13 '12 at 06:14
  • 1
    @Coder_sLaY thanks, didn't realize that part. put detail in case required for other plugin. – dhaval Jul 13 '12 at 06:58