I was trying this code to open a package in playstore:
B4X:
Dim fURI As String
fURI = "market://details?id=com.b4a.example"
Dim Market As Intent
Market.Initialize(Market.ACTION_VIEW,fURI)
StartActivity(Market)
However, it gives an option to any of the two android marketplaces. That's fine, but I need to know when the person clicks on the cancel. How to know when the user clicked the cancel button in an Intent activity? Here is a screenshot to better understand what exactly I mean.
startActivityForResult is available in all versions of Android.
However I'm not sure that it will help you in this case. The user doesn't need to choose here. You want that it will be open with Google Play, right?
Use this code:
B4X:
Dim fURI As String = "market://details?id=com.b4a.example"
Dim Market As Intent
Market.Initialize(Market.ACTION_VIEW,fURI)
Dim pm As PackageManager 'Phone library
For Each act As String In pm.QueryIntentActivities(Market)
If act.StartsWith("com.android") Then
Market.SetComponent(act)
Exit
End If
Next
StartActivity(Market)
They will need to choose? :/ Because some audience does not download from Google Play because they often throw low memory exceptions from old devices that's why many users (specially from South East Asia) prefer other android market places? Can you help?