Android Question Decode URL from Intent

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello,

I'm receiving an intent from a URL shared by chrome to my app. This is a sample:

(Intent)
Intent { act=android.intent.action.SEND typ=text/plain flg=0x1b080001 cmp=com.comten.nexphone/.chats
clip={text/uri-list U:content://com.android.chrome.FileProvider/BlockedFile_140796656339917} (has extras) }

How can I recover the URL address?
 

MarkusR

Well-Known Member
Licensed User
Longtime User
is your sample original? it looks like json but its not correct syntax.
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
is your sample original? it looks like json but its not correct syntax.
Yes, the app received this intent from a Browser (chrome) Share... The code is:

B4X:
    If IsRelevantIntent(Activity.GetStartingIntent) Then
        Dim in As Intent = Activity.GetStartingIntent
        Dim lin As String  = in
        ToastMessageShow(lin,True)
    end if
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Thanks everybody, specially @Jeffrey Cameron . This worked:

B4X:
Dim in As Intent = Activity.GetStartingIntent
Dim Url1 As String = in.GetExtra("android.intent.extra.TEXT")

A very interesting tip. Pausing the code and checking the value of the intent (mouse over), or using the method getdata, will give the keys from a specific intent extras... This will save #A LOT# of time researching in Android Developers forum... ;)
 
Upvote 0
Top