[android-developers] Re: WebView and ConnectivityManager.requestNetwork
OK, that's very different than what you first asked. You will have to write shim to connect your app and the webview. The page hosting the webview will have to provide a function to call that makes the necessary adjustments. Then on the app side you call loadUrl with a javascript url to call that function with whatever parameters it needs. Google "android webview inject javascript" for more details. (Google answers most of your questions if you just ask it.) Doug On Sunday, December 14, 2014 1:45:46 PM UTC-8, Krystian Lewandowski wrote: > > Hi, > the problem is that it is possible to get HTML skeleton (or whatever it > is, because we do not control remote side) via specific route with > additional implementation in shouldInterceptRequest. It is possible to > inject loaded the content via WebView.loadDataWithBaseURL, but that's it. > The question is how to inject additional resources to WebView? > > Thank you, > Krystian > > W dniu niedziela, 14 grudnia 2014 22:33:36 UTC+1 użytkownik Doug napisał: >> >> Did you actually try WebViewClient.shouldInterceptRequest? I'm looking >> through old code of mine that suggests it will work. Also, you should try >> searching for "WebViewClient shouldInterceptRequest" to see what places >> like StackOverflow say. >> >> Doug >> >> On Sunday, December 14, 2014 10:39:21 AM UTC-8, Krystian Lewandowski >> wrote: >>> >>> Hi Doug, >>> I mean, I can get the page and there is onLoadResource I missed last >>> time, but another question is - even if I get a resource, how to inject it? >>> Callbacks, in this case, serve kind of notification purpose there is no way >>> to replace loaded resource (whatever it actually is) or inject custom >>> "loader" instead. At least at the moment I don't see a solution. >>> >>> Thank you for ideas, >>> Krystian >>> >>> W dniu niedziela, 14 grudnia 2014 18:30:15 UTC+1 użytkownik Doug napisał: It's been a long time since I've been active on it, but I believe you can intercept everything that passes through a url, both what would be loaded by navigation, image, and ajax. Give it a try and implement all the callbacks exposed by webview, log a simple message, and see how it goes. Doug On Saturday, December 13, 2014 1:53:56 PM UTC-8, Krystian Lewandowski wrote: > > Thank you for the idea. Though, I don't think it will work. What about > AJAX, objects, images requests? I assume shouldInterceptRequest isn't > called for these. > > Krystian > > W dniu sobota, 13 grudnia 2014 22:14:33 UTC+1 użytkownik Doug napisał: >> >> You could use a WebViewClient to intercept everything a WebView is >> trying to fetch and fetch it yourself using whatever API suits your >> needs. >> >> Doug >> >> On Friday, December 12, 2014 12:15:35 PM UTC-8, Krystian Lewandowski >> wrote: >>> >>> Hi, >>> I'm trying to update ConnectivityManager.requestRouteToHost >>> implementation from deprecated one to >>> ConnectivityManager.requestNetwork >>> introduced in Lollipop. It supports Sockets, SocketFactories, >>> URLConnections - this is fine. The only thing missing at the moment is >>> WebView support. Application's requirement is to route WebView.loadUrl >>> requests via specific interface, but I can't see how it could be done >>> with >>> the new API (I can't use setProcessDefaultNetwork). >>> >>> I looked at WebView API but couldn't find anything new that would >>> support changed routing API. Is it supported, am I missing something? >>> >>> Thank you, >>> Krystian >>> >> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: WebView and ConnectivityManager.requestNetwork
Hi, the problem is that it is possible to get HTML skeleton (or whatever it is, because we do not control remote side) via specific route with additional implementation in shouldInterceptRequest. It is possible to inject loaded the content via WebView.loadDataWithBaseURL, but that's it. The question is how to inject additional resources to WebView? Thank you, Krystian W dniu niedziela, 14 grudnia 2014 22:33:36 UTC+1 użytkownik Doug napisał: > > Did you actually try WebViewClient.shouldInterceptRequest? I'm looking > through old code of mine that suggests it will work. Also, you should try > searching for "WebViewClient shouldInterceptRequest" to see what places > like StackOverflow say. > > Doug > > On Sunday, December 14, 2014 10:39:21 AM UTC-8, Krystian Lewandowski wrote: >> >> Hi Doug, >> I mean, I can get the page and there is onLoadResource I missed last >> time, but another question is - even if I get a resource, how to inject it? >> Callbacks, in this case, serve kind of notification purpose there is no way >> to replace loaded resource (whatever it actually is) or inject custom >> "loader" instead. At least at the moment I don't see a solution. >> >> Thank you for ideas, >> Krystian >> >> W dniu niedziela, 14 grudnia 2014 18:30:15 UTC+1 użytkownik Doug napisał: >>> >>> It's been a long time since I've been active on it, but I believe you >>> can intercept everything that passes through a url, both what would be >>> loaded by navigation, image, and ajax. Give it a try and implement all the >>> callbacks exposed by webview, log a simple message, and see how it goes. >>> >>> Doug >>> >>> On Saturday, December 13, 2014 1:53:56 PM UTC-8, Krystian Lewandowski >>> wrote: Thank you for the idea. Though, I don't think it will work. What about AJAX, objects, images requests? I assume shouldInterceptRequest isn't called for these. Krystian W dniu sobota, 13 grudnia 2014 22:14:33 UTC+1 użytkownik Doug napisał: > > You could use a WebViewClient to intercept everything a WebView is > trying to fetch and fetch it yourself using whatever API suits your needs. > > Doug > > On Friday, December 12, 2014 12:15:35 PM UTC-8, Krystian Lewandowski > wrote: >> >> Hi, >> I'm trying to update ConnectivityManager.requestRouteToHost >> implementation from deprecated one to ConnectivityManager.requestNetwork >> introduced in Lollipop. It supports Sockets, SocketFactories, >> URLConnections - this is fine. The only thing missing at the moment is >> WebView support. Application's requirement is to route WebView.loadUrl >> requests via specific interface, but I can't see how it could be done >> with >> the new API (I can't use setProcessDefaultNetwork). >> >> I looked at WebView API but couldn't find anything new that would >> support changed routing API. Is it supported, am I missing something? >> >> Thank you, >> Krystian >> > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: WebView and ConnectivityManager.requestNetwork
Did you actually try WebViewClient.shouldInterceptRequest? I'm looking through old code of mine that suggests it will work. Also, you should try searching for "WebViewClient shouldInterceptRequest" to see what places like StackOverflow say. Doug On Sunday, December 14, 2014 10:39:21 AM UTC-8, Krystian Lewandowski wrote: > > Hi Doug, > I mean, I can get the page and there is onLoadResource I missed last time, > but another question is - even if I get a resource, how to inject it? > Callbacks, in this case, serve kind of notification purpose there is no way > to replace loaded resource (whatever it actually is) or inject custom > "loader" instead. At least at the moment I don't see a solution. > > Thank you for ideas, > Krystian > > W dniu niedziela, 14 grudnia 2014 18:30:15 UTC+1 użytkownik Doug napisał: >> >> It's been a long time since I've been active on it, but I believe you can >> intercept everything that passes through a url, both what would be loaded >> by navigation, image, and ajax. Give it a try and implement all the >> callbacks exposed by webview, log a simple message, and see how it goes. >> >> Doug >> >> On Saturday, December 13, 2014 1:53:56 PM UTC-8, Krystian Lewandowski >> wrote: >>> >>> Thank you for the idea. Though, I don't think it will work. What about >>> AJAX, objects, images requests? I assume shouldInterceptRequest isn't >>> called for these. >>> >>> Krystian >>> >>> W dniu sobota, 13 grudnia 2014 22:14:33 UTC+1 użytkownik Doug napisał: You could use a WebViewClient to intercept everything a WebView is trying to fetch and fetch it yourself using whatever API suits your needs. Doug On Friday, December 12, 2014 12:15:35 PM UTC-8, Krystian Lewandowski wrote: > > Hi, > I'm trying to update ConnectivityManager.requestRouteToHost > implementation from deprecated one to ConnectivityManager.requestNetwork > introduced in Lollipop. It supports Sockets, SocketFactories, > URLConnections - this is fine. The only thing missing at the moment is > WebView support. Application's requirement is to route WebView.loadUrl > requests via specific interface, but I can't see how it could be done > with > the new API (I can't use setProcessDefaultNetwork). > > I looked at WebView API but couldn't find anything new that would > support changed routing API. Is it supported, am I missing something? > > Thank you, > Krystian > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: WebView and ConnectivityManager.requestNetwork
Hi Doug, I mean, I can get the page and there is onLoadResource I missed last time, but another question is - even if I get a resource, how to inject it? Callbacks, in this case, serve kind of notification purpose there is no way to replace loaded resource (whatever it actually is) or inject custom "loader" instead. At least at the moment I don't see a solution. Thank you for ideas, Krystian W dniu niedziela, 14 grudnia 2014 18:30:15 UTC+1 użytkownik Doug napisał: > > It's been a long time since I've been active on it, but I believe you can > intercept everything that passes through a url, both what would be loaded > by navigation, image, and ajax. Give it a try and implement all the > callbacks exposed by webview, log a simple message, and see how it goes. > > Doug > > On Saturday, December 13, 2014 1:53:56 PM UTC-8, Krystian Lewandowski > wrote: >> >> Thank you for the idea. Though, I don't think it will work. What about >> AJAX, objects, images requests? I assume shouldInterceptRequest isn't >> called for these. >> >> Krystian >> >> W dniu sobota, 13 grudnia 2014 22:14:33 UTC+1 użytkownik Doug napisał: >>> >>> You could use a WebViewClient to intercept everything a WebView is >>> trying to fetch and fetch it yourself using whatever API suits your needs. >>> >>> Doug >>> >>> On Friday, December 12, 2014 12:15:35 PM UTC-8, Krystian Lewandowski >>> wrote: Hi, I'm trying to update ConnectivityManager.requestRouteToHost implementation from deprecated one to ConnectivityManager.requestNetwork introduced in Lollipop. It supports Sockets, SocketFactories, URLConnections - this is fine. The only thing missing at the moment is WebView support. Application's requirement is to route WebView.loadUrl requests via specific interface, but I can't see how it could be done with the new API (I can't use setProcessDefaultNetwork). I looked at WebView API but couldn't find anything new that would support changed routing API. Is it supported, am I missing something? Thank you, Krystian >>> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: WebView and ConnectivityManager.requestNetwork
It's been a long time since I've been active on it, but I believe you can intercept everything that passes through a url, both what would be loaded by navigation, image, and ajax. Give it a try and implement all the callbacks exposed by webview, log a simple message, and see how it goes. Doug On Saturday, December 13, 2014 1:53:56 PM UTC-8, Krystian Lewandowski wrote: > > Thank you for the idea. Though, I don't think it will work. What about > AJAX, objects, images requests? I assume shouldInterceptRequest isn't > called for these. > > Krystian > > W dniu sobota, 13 grudnia 2014 22:14:33 UTC+1 użytkownik Doug napisał: >> >> You could use a WebViewClient to intercept everything a WebView is trying >> to fetch and fetch it yourself using whatever API suits your needs. >> >> Doug >> >> On Friday, December 12, 2014 12:15:35 PM UTC-8, Krystian Lewandowski >> wrote: >>> >>> Hi, >>> I'm trying to update ConnectivityManager.requestRouteToHost >>> implementation from deprecated one to ConnectivityManager.requestNetwork >>> introduced in Lollipop. It supports Sockets, SocketFactories, >>> URLConnections - this is fine. The only thing missing at the moment is >>> WebView support. Application's requirement is to route WebView.loadUrl >>> requests via specific interface, but I can't see how it could be done with >>> the new API (I can't use setProcessDefaultNetwork). >>> >>> I looked at WebView API but couldn't find anything new that would >>> support changed routing API. Is it supported, am I missing something? >>> >>> Thank you, >>> Krystian >>> >> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] NoClassDefFound happening randomly
Hi there, I am receiving hundred of error reports of the type " java.lang.NoClassDefFoundError" from my users that so far I have been unable to reproduce. These started to happen a couple of releases ago, with a change that is not relevant at all for the case because it is an update of a jar library that has nothing to see with that class. Also *I know positively that such class is in the apk*, because I have checked it by unzipping the apk and using dexdump to see what is inside classes.dex (unnecessary effort anyway, since if the class definition wasn't there, the crash would happen always). It seems like *the older the Android version, the highest the possibility of crash*: 2.3.6 gets about 50% of all the crashes (I attach a screenshot with those). *But* I have tried it in a 2.3.6 Android emulator and it didn't crashed, so it seems version number is not sufficient condition by itself to reproduce the crash. I have come to the conclusion that there is nothing wrong in my code, what could seem convenient to exonerate myself but actually is quite inconvenient since I do not really know how to solve this. The answer to the question "why would a NoClassDefFound exception been thrown in presence of such class?" is still hidden to me. I have also investigated this until the edge of my knowledge, thus I need some help from some guru out there, if any. Thanks a million in advance, ps. The stack dump, just in case: 0java.lang.NoClassDefFoundError: com.facebook.internal.Utility$11 at com.facebook.internal.Utility.void loadAppSettingsAsync(android.content.Context,java.lang.String)(Unknown Source)2 at com.facebook.Settings.void sdkInitialize(android.content.Context)(Unknown Source)3 at com.facebook.UiLifecycleHelper.(Unknown Source)4 at net.iberdroid.androidgames.framework.impl.AndroidGame.void onCreate(android.os.Bundle)(Unknown Source)5* at com.marzoa.ruletafree.RuletaAfortunadaGame.void onCreate(android.os.Bundle)(Unknown Source)*6 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)7 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)8 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675) 9 at android.app.ActivityThread.access$1500(ActivityThread.java:121)10 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)11 at android.os.Handler.dispatchMessage(Handler.java:99)12 at android.os.Looper.loop(Looper.java:130)13 at android.app.ActivityThread.main(ActivityThread.java:3768)14 at java.lang.reflect.Method.invokeNative(Native Method)15 at java.lang.reflect.Method.invoke(Method.java:507)16 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878) 17 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)18 at dalvik.system.NativeStart.main(Native Method)19*Caused by: java.lang.ClassNotFoundException: com.facebook.internal.Utility$1 in loader dalvik.system.PathClassLoader[/data/app/com.marzoa.ruletafree-1.apk]*20 at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)21 at java.lang.ClassLoader.loadClass(ClassLoader.java:551)22 at java.lang.ClassLoader.loadClass(ClassLoader.java:511)23 ... 18 more -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.