react-native-send-intent icon indicating copy to clipboard operation
react-native-send-intent copied to clipboard

SendIntentAndroid.openApp not working when called in background

Open renege opened this issue 5 years ago • 3 comments

Hi, I have a background service running and there I call: SendIntentAndroid.openApp('com.foobar') But the app is not opening to the foreground when triggered in the background. The function is called, I can see that in the logs.

When I call the same function when the App is open, it does work..

@lucasferreira

renege avatar Apr 17 '20 09:04 renege

I have this issue too. I Found out it was related to the App's "Display over other apps" permission, if you turn that on, and try again did it work? If so you might have a permissions issue. I am using android 11 device on an app the has a background messaging service. I was able to do a work around by adding this to the service element

<service android:name="insert.your.service.package" android:permission="android.permission.BIND_SCREENING_SERVICE"> <intent-filter> <action android:name="android.telecom.CallScreeningService"/> </intent-filter> </service> I have read in the docs that apps that have CallScreeningService automatically get this permission granted.
https://developer.android.com/about/versions/11/privacy/permissions // go down to where it talks about android 11 changes. this helped on android 11 but I think it might not on lower versions...

BertoGz avatar Feb 22 '21 20:02 BertoGz

Same issue, i wanted to open app when the main app receive a push notification on background, but did not work, and when it is handled on foreground, it works good. (Android 11) it was just a test, cause the final goal is that my app open itself when a push notification is received from quite state.

parazitenew avatar Jul 07 '21 18:07 parazitenew

Hello, any news about this? I have the same problem: I'm calling SendIntentAndroid.openApp(...) from a react native BackgroundTimer.runBackgroundTimer(). The background task is running correctly, but the external app is opened only if my app is in the foreground.

softmasters avatar Oct 26 '22 19:10 softmasters