[@capacitor/share] "Can't share while sharing is in progress" when sharing to the same app on Android
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Inizia dall'implementazione Android di SharePlugin e traccia share(), activityResult(), isPresenting e handleOnNewIntent(), prestando attenzione a come MainActivity viene riutilizzata per ACTION_SEND. Riproduci il problema con l'app di esempio collegata, quindi verifica che una condivisione in entrata reimposti lo stato in corso e che le condivisioni successive vadano a buon fine.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Report
Plugin(s)
@capacitor/share
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 7.4.3
@capacitor/core: 7.4.3
@capacitor/android: 7.4.3
@capacitor/ios: 7.4.3
Installed Dependencies:
@capacitor/ios: not installed
@capacitor/cli: 7.4.3
@capacitor/core: 7.4.3
@capacitor/android: 7.4.3
[success] Android looking great! 👌
Platform(s)
Android
Current Behavior
In my app I have both outgoing + incoming share functionality. When I try to share anything to the same app, the plugin's Android implementation becomes stuck in some "in-progress" state, and subsequent share calls immediately fail with error:
Can't share while sharing is in progress
Expected Behavior
All subsequent shares from the app into same app work OK.
Code Reproduction
I've prepared reproduction repo - please check out https://github.com/dmitry-salnikov/capacitor-share-plugin-bug-reproduction
Other Technical Details
Android only, everything works OK on iOS.
Additional Context
The problem
- Android tries to launch
MainActivitywith theACTION_SEND intent. - Because
launchMode="singleTask", Android doesn't create a new activity instance. Instead, it reuses the existing task and brings it to the front. - Since the activity never finishes (it's the same instance),
activityResult()is never called. - This way,
isPresentingflag isn't reset, and all subsequent calls toshare()would throw errorCan't share while sharing is in progress.
The solution
Handle incoming share intent in SharePlugin's code to reset isPresenting flag and resolve plugin call, e.g.:
@Override
protected void handleOnNewIntent(Intent intent) {
if (isPresenting && intent != null && Intent.ACTION_SEND.equals(intent.getAction())) {
PluginCall call = bridge.getSavedCall("activityResult");
if (call != null) {
call.resolve(new JSObject().put("activityType", ""));
}
isPresenting = false;
}
}
- Lingua principale
- Java
- Stelle
- 685
- Fork
- 691
- Merge medio
- 16h 33m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ionic-team/capacitor-plugins
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ionic-team/capacitor-plugins#2616 ·
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguageApertatriage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ionic-team/capacitor-plugins#2604 ·
-
triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
ionic-team/capacitor-plugins#2615 ·
-
triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
ionic-team/capacitor-plugins#2614 ·
-
platform: android platform: ios
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
ionic-team/capacitor-plugins#2613 ·
Tutte le issue di ionic-team/capacitor-plugins
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
federicoiosue/Omni-Notes#1032 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
unitycatalog/unitycatalog#2025 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
krizaka/krizaka-notifications#22 ·
I maintainer di solito rispondono entro 1 giorno
-
CommandDispatcher.register returns a node that is not in the tree when the literal is already registeredForse già presa @auraseb l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
-
ToolCallbackProvider AutoConfiguration does not preserve tool orderForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertastatus: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
spring-projects/spring-ai#7206 ·
I maintainer di solito rispondono entro 2 giorni