Android Question PhoneIntents Error (intent://...)

KIM jihoon

Member
Licensed User
Longtime User
Thanks for the help

B4X:
Sub WebView1_OverrideUrl (Url As String) As Boolean
Log(Url) '-"intent://pay?srCode=3325365#Intent;scheme=shinhan-sr-ansimclick;package=com.shcard.smartpay;end;"
    If Url.Contains("intent") Then
        Dim p As PhoneIntents
        StartActivity(p.OpenBrowser(Url))'- <-- Error
'        Return True
    End If
End Sub

'- Error
Error occurred on line: 9 (WebPage)
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=intent://pay?srCode=3325365 flg=0x20000 }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2071)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1717)

...............

'- The app is installed on the phone
Package = com.shcard.smartpay

'- Reference :
External browsers are no problem
Error occurs only in webview (WebView1)
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
i can't tell you for sure how to solve your problem, but i think i can make
some suggestions as to why you have a problem.

first, webview basically has nothing to do with the crash. i'm responding
only because i enjoy every time someone blames webview for something.

it appears that you understand intent:// url's cannot be handled by webview,
and that is why you have overrideurl(). webview is, in fact, doing what it's
supposed to do in this case.

there are, i believe 2 issues with your b4a code:
1) you need to uncomment return true at line 6. (you need to return true or
false to overrideurl(). but this is not where the real problem is.
2) you probably do not want to use a phoneintent to open the default browser.

i believe phoneintent's openbrower method is an implicit intent. its action
defaults to VIEW. with a properly formatted url/uri, things should work ok. this
may not be what you want in this case.

i believe what you need is an explicit intent.

an implicit intent works if the target accepts being a target of the action you
specify (in this case VIEW). the payment app you refer to might possibly not
accept any intents. perhaps you are familiar with the inner workings of the
application.

an explicit intent will succeed regardless of an action or regardless of whether
the target accepts intents so long as you specify the correct package name.

the full url seems to involve more than just the application's package name, so
you'd probably need to deal with what i presume are some kind of parameters.
all of this can be handled in b4a by dealing with the Intent class instead of
phoneintents (which, i think, are sort of a convenience class). you can set various
facets of the intent in b4a. you can't with a phoneintent.

i don't have the payment app loaded, but i did run into the same "activity not found"
error while looking into your problem. apps which were, in fact, installed, were
said to be "not found". i resolved it with an explicit intent (intent.setComponent()).
you may also have to strip out the "intent://" part of the package name.

i hope i'm not leading you farther from a solution.
 
Upvote 0

KIM jihoon

Member
Licensed User
Longtime User
Thank you very much "drgottjr"

I agree it's not WebView problem.
"intent://pay?srCode=3325365#Intent;scheme=shinhan-sr-ansimclick;package=com.shcard.smartpay;end;"
The statement seems to have an executable package (com.shcard.smartpay) and an option after execution.

The problem is that PhoneIntents can't do this.
(The phone has "com.shcard.smartpay" installed)

it doesn't solve the problem
need someone's help

B4X:
dim url="https://vbv.shinhancard.com/mobile/MBITFX000.jsp;JSESSIONID=JmVpoDKg0Dy0MTeHK5sYxDGlBKg1hCdOIQPYiMBcnytay9d2JGQAawOqMGj1TJfm.prvbvap1_servlet_vbvssl2"
WebView1.LoadUrl(url)

Sub WebView1_OverrideUrl (Url As String) As Boolean
Log(Url) '-"intent://pay?srCode=3325365#Intent;scheme=shinhan-sr-ansimclick;package=com.shcard.smartpay;end;"
    If Url.Contains("intent") Then
        Dim p As PhoneIntents
        StartActivity(p.OpenBrowser(Url))'- <-- Error
'        Return True
    End If
End Sub

Error Description (WebView) :
net : ERR_UNKNOWN_URL_SCHEME
 
Last edited:
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
my impression is that you understood very little of what i posted. i am very sorry.
i said NOT to use phoneintents. i also said you should try with an explicit intent because the payment app may not respond to an implicit attempt.
 
Upvote 0

KIM jihoon

Member
Licensed User
Longtime User
Thank you for your response
I understand your comments are enough
I also know the explicit handling like

'------------------
Dim pm As PackageManager
Dim in As Intent=pm.GetApplicationIntent("com.shcard.smartpay")
StartActivity(in)
'------------------

However, it is not possible to explicitly make multibank credit card payments.

No problem in external (chrome) browser
It is only a problem when dealing with webview.

Any other ideas to solve this problem?
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i can load the full url in a webview. (and, yes, i know what the alert says.) you need a chrome client (among other things). i am afraid we are talking at cross purposes here; you reveal too little. good luck.
 

Attachments

  • cap.png
    cap.png
    19.5 KB · Views: 223
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Use intent, Try something like this:
B4X:
Sub WebView1_OverrideUrl (Url As String) As Boolean
    Log(Url) '-"intent://pay?srCode=3325365#Intent;scheme=shinhan-sr-ansimclick;package=com.shcard.smartpay;end;"
    If Url.Contains("intent") Then
        dim intent1 as intent
        intent1.initialize(intent1.ACTION_*,"")
           intent1.setpackage("com.shcard.smartpay")
        intent1.PutExtra("srCode","3325365")
        StartActivity(intent1)
    End If
'        Return True
End Sub
 
Upvote 0

KIM jihoon

Member
Licensed User
Longtime User
i can load the full url in a webview. (and, yes, i know what the alert says.) you need a chrome client (among other things). i am afraid we are talking at cross purposes here; you reveal too little. good luck.

Thanks for the help !!!

URL
WebView1.LoadURL("http://49.247.20.64/Payment/iamport.ASP")

Next code between 3 and 4 screen
Sub WebView1_OverrideUrl (Url As String) As Boolean
Log(Url) '-"intent://pay?srCode=3325365#Intent;scheme=shinhan-sr-ansimclick;package=com.shcard.smartpay;end;"
If Url.Contains("intent") Then
Dim p As PhoneIntents
StartActivity(p.OpenBrowser(Url))'- <-- Error
End If
End Sub

Reference : OverrideUrl (Url As String)
1). https://vbv.shinhancard.com/mobile/...rv1aJRoOvPFsBtxiVbxQ.prvbvap3_servlet_vbvssl2
2). intent://pay?srCode=5932218#Intent;scheme=shinhan-sr-ansimclick;package=com.shcard.smartpay;end;

Error :
Error occurred on line: 9 (WebPage)
android.content.ActivityNotFoundException: No Activity found to handle ......

1.png
2.png
3.png
4.png


In case of normal processing, the next screen 5 is displayed (instead of 4)

5). job done (* External browser handling)


5.png
 
Last edited:
Upvote 0
Top