Android Question Intent Crashes on Android 10

cbanks

Active Member
Licensed User
Longtime User
The following code has pulled up the Facebook app if it exists on the device and has worked for years. It now crashes my app if my app is running on Android 10. What do I need to change to make it work for Android 10 as well?

B4X:
Dim pm As PackageManager
Dim In As Intent
In = pm.GetApplicationIntent("com.facebook.katana")

If In.IsInitialized Then 'This part crashes my app
     In.Initialize(In.ACTION_VIEW,"fb://page/280396775373599")
     StartActivity(In)
Else
     Dim Facebook As Intent
     Facebook.Initialize(Facebook.ACTION_VIEW, "http://www.facebook.com/LDSScripturesPremium")
     StartActivity(Facebook)
End If

If the Facebook app is running in the background then the code works fine, but if it's not running in the background then my app crashes when trying to pull up the Facebook app on Android 10.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
You mean "Hiding the complete ERROR message is a good idea to get help"?
 
Upvote 0

cbanks

Active Member
Licensed User
Longtime User
My app crashes on Android 10 when that code is executed. Works fine on all other Android versions. I don't know how to get the error message you're referring to.

If the Facebook app is running in the background then the code works fine, but if it's not running in the background then my app crashes when trying to pull up the Facebook app on Android 10.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
My app crashes on Android 10 when that code is executed
Then the error is inside the LOG! There is no crash in Android without being logged.
Connect your device using USB Debugging and watch the log. Maybe the unfiltered one; but the Error MUST be present.
 
Upvote 0
Top