Android webview not loading https url

When try to load url (with https) in webview … not loading showing Web page not available .

if i load http://google.com or http://yahoo.com its working fine.

i add this lines to build.setting

[background=’’]android =
{
usesPermissions =
{
“android.permission.INTERNET”,
“android.permission.CALL_PHONE”,
“android.permission.ACCESS_NETWORK_STATE”,
– Optional permission used to display current location via WiFi or cellular service.
“android.permission.ACCESS_COARSE_LOCATION”,
“com.google.android.c2dm.permission.RECEIVE”,
},
usesFeatures =
{
– If you set permissions “ACCESS_FINE_LOCATION” and “ACCESS_COARSE_LOCATION” above,
– then you may want to set up your app to not require location services as follows.
– Otherwise, devices that do not have location sevices (such as a GPS) will be unable
– to purchase this app in the app store.
{ name = “android.hardware.location”, required = false },
{ name = “android.hardware.location.gps”, required = false },
{ name = “android.hardware.location.network”, required = false },
},
},[/background]

Log file

[background=’’]GT-I9300: url=https://sep.shaparak.ir/Payment.aspx
Aug 26 02:12:45.830 GT-I9300: Exception when stopping service com.google.android.gms/.analytics.service.AnalyticsService

GT-I9300: android.os.TransactionTooLargeException

GT-I9300: at android.os.BinderProxy.transact(Native Method)

GT-I9300: at android.app.ApplicationThreadProxy.scheduleStopService(ApplicationThreadNative.java:909)

GT-I9300: at com.android.server.am.ActiveServices.bringDownServiceLocked(ActiveServices.java:1296)

GT-I9300: at com.android.server.am.ActiveServices.removeConnectionLocked(ActiveServices.java:1377)

GT-I9300: at com.android.server.am.ActiveServices.killServicesLocked(ActiveServices.java:1652)

GT-I9300: at com.android.server.am.ActivityManagerService.cleanUpApplicationRecordLocked(ActivityManagerService.java:12810)

GT-I9300: at com.android.server.am.ActivityManagerService.handleAppDiedLocked(ActivityManagerService.java:3766)

GT-I9300: at com.android.server.am.ActivityManagerService.appDiedLocked(ActivityManagerService.java:3870)

GT-I9300: at com.android.server.am.ActivityManagerService$AppDeathRecipient.binderDied(ActivityManagerService.java:1045)

GT-I9300: at android.os.BinderProxy.sendDeathNotice(Binder.java:470)

GT-I9300: at dalvik.system.NativeStart.run(Native Method)

GT-I9300: Canceling start item Intent { act=com.battery.c.model.ACTION_CHARGING cmp=com.kingouser.com/com.apusapps.battery.ChargingCoreService (has extras) } in service ComponentInfo{com.kingouser.com/com.apusapps.battery.ChargingCoreService}[/background]

Hi @jalalimehdi and welcome to the Corona Labs forums. I looked up the error message and I’m not sure what it would have to do with a webView. It’s talking about passing too much data through a remote procedure call or between Intents. I’ll have to ask the engineers if that makes sense. Perhaps the web page is trying to transmit too much data, but I looked at the URL and it was pretty light weight.

Can you post your code where you’re creating your webView?

Please click on the the blue <> button in the edit bar and paste your code into the window that pops up.

Thanks

Rob

Hi Rob Miracle   :)  thanks for answer

I post my code where I’m creating my webView

another my problem is out put event.type in webListener

when is running in emulator is print(event.type) ===> loaded

when is running in ios is print(event.type) ===> form

when is running in android is print(event.type) ===> loaded

why is diffrent value  in ios (event.type)?

 local function webListener(event) if event.errorCode then print( "Error!", event.errorMessage, { "OK" } ) end print("showWebPopup callback") print(json.encode(event)) local url = event.url if ( event.type ) then print( event.type ) end print("url="..url) if (event.type== "loaded" or event.type== "form") then if( string.find( url, "shaparak" ) ~= nil ) then if (loading~=nil) then transition.cancel( "transTag" ) loading:removeSelf() -- widgets must be manually removed loading = nil loadingBack:removeSelf() -- widgets must be manually removed loadingBack = nil loadbackground:removeSelf() -- widgets must be manually removed loadbackground = nil webView.alpha = 1 backBtn.alpha = 1 end end end if ( event.type== "loaded" or event.type== "form") then if( url == "http://programmingco.ir/" ) then --sumOfsee=0 -- system.openURL(url) backTouched() composer.gotoScene ( "erteghascene","fromRight", 300 ) end end return true end local wTemp = math.floor(\_H\*0.1 \*0.5) webView = native.newWebView(0, 71, display.actualContentWidth, display.actualContentHeight-wTemp) webView.x = display.contentCenterX webView.y = 0 +screenY +wTemp webView.anchorY = 0 webView.anchorX = 0.5 webView:request("http://programmingco.ir/buymellat/ir.programmingco.bechin.coin1/123?customerEmail=m2jalalimehdi@yahoo.com&customerOrderId=ir.programmingco.bechin.coin1) webView:addEventListener( "urlRequest", webListener ) and my webListener function

I don’t have an answer for why iOS is different, but you’ve programmed the right test to handle it.

You’re webView:request() is missing a " at the end of the string. That should cause a different error, so I’m not sure how you’re getting to the error you’re getting.  URL’s also have to have the parts after the ? “url encoded”.  In particular the email has an @ sign which isn’t save to transmit as part of a URL.

You need to run the mail address through a URL encoder (or any value that has things other than letters, numbers, hypens, underscores and periods in it) to make it safe to be part of a URL.

Here is the one I use:

function urlencode(str) if (str) then str = string.gsub (str, "\n", "\r\n") str = string.gsub (str, "([^%w])", function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") end return str end

I would try it with the encoded email address, but I doubt that’s the cause. The URL above when putting it into my web browser is doing a redirect from an http: site to an https: site. That could be causing a problem. It was also pretty slow the first time. Can you use https:// for your programmingco.ir site?

thanks

I used urlencode function.

but that’s not the cause,

I’m trying Enable https for programmingco.ir.

there is not another solution?

Does the webView you’re trying work on iOS?

that is ok on ios.

all things work (perfectly) together for ios

Can you make a simple demo app that an Engineer could run on both iOS and Android that demonstrates the problem?  It would need a main.lua, config.lua, build.settings and any other files needed to let us open it in the simulator build it for device, run it and see the problem?

If so, please build it, put it all in a .zip file and use the Report and Bug link at the top of the page. In the form you fill out, it would be helpful to also post a link to this thread in addition to writing a good description of the problem. You will get an email back with an number in it that I can use to track the bug later. Please post that back here as a reference.

Thanks

Rob

I make a simple demo app and send you thanks a lot

Hi @jalalimehdi and welcome to the Corona Labs forums. I looked up the error message and I’m not sure what it would have to do with a webView. It’s talking about passing too much data through a remote procedure call or between Intents. I’ll have to ask the engineers if that makes sense. Perhaps the web page is trying to transmit too much data, but I looked at the URL and it was pretty light weight.

Can you post your code where you’re creating your webView?

Please click on the the blue <> button in the edit bar and paste your code into the window that pops up.

Thanks

Rob

Hi Rob Miracle   :)  thanks for answer

I post my code where I’m creating my webView

another my problem is out put event.type in webListener

when is running in emulator is print(event.type) ===> loaded

when is running in ios is print(event.type) ===> form

when is running in android is print(event.type) ===> loaded

why is diffrent value  in ios (event.type)?

 local function webListener(event) if event.errorCode then print( "Error!", event.errorMessage, { "OK" } ) end print("showWebPopup callback") print(json.encode(event)) local url = event.url if ( event.type ) then print( event.type ) end print("url="..url) if (event.type== "loaded" or event.type== "form") then if( string.find( url, "shaparak" ) ~= nil ) then if (loading~=nil) then transition.cancel( "transTag" ) loading:removeSelf() -- widgets must be manually removed loading = nil loadingBack:removeSelf() -- widgets must be manually removed loadingBack = nil loadbackground:removeSelf() -- widgets must be manually removed loadbackground = nil webView.alpha = 1 backBtn.alpha = 1 end end end if ( event.type== "loaded" or event.type== "form") then if( url == "http://programmingco.ir/" ) then --sumOfsee=0 -- system.openURL(url) backTouched() composer.gotoScene ( "erteghascene","fromRight", 300 ) end end return true end local wTemp = math.floor(\_H\*0.1 \*0.5) webView = native.newWebView(0, 71, display.actualContentWidth, display.actualContentHeight-wTemp) webView.x = display.contentCenterX webView.y = 0 +screenY +wTemp webView.anchorY = 0 webView.anchorX = 0.5 webView:request("http://programmingco.ir/buymellat/ir.programmingco.bechin.coin1/123?customerEmail=m2jalalimehdi@yahoo.com&customerOrderId=ir.programmingco.bechin.coin1) webView:addEventListener( "urlRequest", webListener ) and my webListener function

I don’t have an answer for why iOS is different, but you’ve programmed the right test to handle it.

You’re webView:request() is missing a " at the end of the string. That should cause a different error, so I’m not sure how you’re getting to the error you’re getting.  URL’s also have to have the parts after the ? “url encoded”.  In particular the email has an @ sign which isn’t save to transmit as part of a URL.

You need to run the mail address through a URL encoder (or any value that has things other than letters, numbers, hypens, underscores and periods in it) to make it safe to be part of a URL.

Here is the one I use:

function urlencode(str) if (str) then str = string.gsub (str, "\n", "\r\n") str = string.gsub (str, "([^%w])", function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") end return str end

I would try it with the encoded email address, but I doubt that’s the cause. The URL above when putting it into my web browser is doing a redirect from an http: site to an https: site. That could be causing a problem. It was also pretty slow the first time. Can you use https:// for your programmingco.ir site?

thanks

I used urlencode function.

but that’s not the cause,

I’m trying Enable https for programmingco.ir.

there is not another solution?

Does the webView you’re trying work on iOS?

that is ok on ios.

all things work (perfectly) together for ios

Can you make a simple demo app that an Engineer could run on both iOS and Android that demonstrates the problem?  It would need a main.lua, config.lua, build.settings and any other files needed to let us open it in the simulator build it for device, run it and see the problem?

If so, please build it, put it all in a .zip file and use the Report and Bug link at the top of the page. In the form you fill out, it would be helpful to also post a link to this thread in addition to writing a good description of the problem. You will get an email back with an number in it that I can use to track the bug later. Please post that back here as a reference.

Thanks

Rob

I make a simple demo app and send you thanks a lot