Webview and Market URLS - Leadbolt

straybullet

Member
Licensed User
Longtime User
I am testing out Leadbolt's new APP WAll

The App wall shows a list of installable apps, but when you click on any of them you get a page not found.

Well the URL starts with market:// but webview does not try to open the market app with these URLS, is there anyway to force webview to use the market app for these type URLS. The standard browser (which webview I think calls) works fine. I have tested this on OS 2.2 and 3.1 and same issue.


Any help would be greatly appreciated


Thanks!
 

admac231

Active Member
Licensed User
Longtime User
Use the WebView1_OverrideUrl sub to parse the url to see if it contains "market://". If it does, take the url and open the Market app using an intent.

B4X:
Sub WebView1_OverrideUrl (Url As String) As Boolean
   If url.IndexOf("market://")>-1 Then 
      Dim market As Intent
      market.Initialize(market.ACTION_VIEW,url)
      StartActivity (market)
   End If
End Sub

Apologies if this doesn't work. Just wrote it off the top of my head but you should get the gist of it.
 
Upvote 0

ssg

Well-Known Member
Licensed User
Longtime User
Hi admac231,

That's right, just that you do not need to check if it contains "market://".

The code you provided above will know whether to load the browser or the market app.

Cheers!
 
Last edited:
Upvote 0

straybullet

Member
Licensed User
Longtime User
Thanks admac231 that worked!

Use the WebView1_OverrideUrl sub to parse the url to see if it contains "market://". If it does, take the url and open the Market app using an intent.

B4X:
Sub WebView1_OverrideUrl (Url As String) As Boolean
   If url.IndexOf("market://")>-1 Then 
      Dim market As Intent
      market.Initialize(market.ACTION_VIEW,url)
      StartActivity (market)
   End If
End Sub

Apologies if this doesn't work. Just wrote it off the top of my head but you should get the gist of it.
 
Upvote 0

mkvidyashankar

Active Member
Licensed User
Longtime User
Use the WebView1_OverrideUrl sub to parse the url to see if it contains "market://". If it does, take the url and open the Market app using an intent.

B4X:
Sub WebView1_OverrideUrl (Url As String) As Boolean
   If url.IndexOf("market://")>-1 Then 
      Dim market As Intent
      market.Initialize(market.ACTION_VIEW,url)
      StartActivity (market)
   End If
End Sub

Apologies if this doesn't work. Just wrote it off the top of my head but you should get the gist of it.



Thanks, it is working :sign0098:
 
Upvote 0

Tom Christman

Active Member
Licensed User
Longtime User
I've added that subroutine code for parsing the url and get an error .... "Undeclared variable 'url' is used before it was assigned any value" at the line that contains the "If Url.Index of ("market://")>-1 Then" Am I missing a Dim or Initialize statement?

Also, the first time I added the webview statements for the Leadbolt app wall, I was using my private signing key when compiling the code and got errors in the log:
"sqlite returned: error code = 14, msg = cannot open file at source line 25467"
"Unable to create webviewCache directory" etc.
After a night of trying to track down the problem, I switched to the "Debug key", and the code worked. I then went back to my private key, and the code worked! So I don't know why that happened, but, if anyone else experiences the same problem, the fix is to use the Debug key and then switch back to your private key.
 
Upvote 0

admac231

Active Member
Licensed User
Longtime User
The Url As String is essentially the Dim statement here Tom.

Try opening the sub in the IDE (that is, type Sub>>[SPACE]>>[Tab] then select WebView then PageFinished) and Put the sub code in there.
 
Upvote 0
Top