Non dovresti davvero preoccuparti del valore effettivo del codice di richiesta utilizzato internamente di Facebook, in quanto il risultato di CallbackManager.onActivityResult(requestCode, resultCode, data)
ti comunicherà se è stato gestito o meno. Vale a dire, prima offrire il risultato allo CallbackManager
. Se indica che è stato gestito, hai finito. Se non è stato gestito, è uno dei risultati del tuo altro codice di richiesta, quindi continua semplicemente con la logica che hai già in essere.
Dal docs on CallbackManager
:
/**
* The method that should be called from the Activity's or Fragment's onActivityResult method.
* @param requestCode The request code that's received by the Activity or Fragment.
* @param resultCode The result code that's received by the Activity or Fragment.
* @param data The result data that's received by the Activity or Fragment.
* @return true If the result could be handled.
*/
public boolean onActivityResult(int requestCode, int resultCode, Intent data);
Annotare la @return
osservazione.
Quindi, in pratica, il codice dovrebbe essere strutturato un po 'come questo:
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
boolean handled = callbackManager.onActivityResult(requestCode, resultCode, data);
if (handled) { /* all done */ }
else { /* result wasn't handled by the callback manager, so check for other potential request codes */ }
}
Se si vuole veramente, è possibile immergersi nella fonte Facebook SDK per rintracciare l'origine del codice di richiesta. In particolare, fare riferimento a CallbackManagerImpl
, dove i callback statici sono impostati con un offset di codice di richiesta predefinito.
fonte
2015-09-27 08:44:39
il codice di richiesta '64206' è semplicemente' 0xface'. Controlla la risposta qui sotto. –
Analogamente, il codice di richiesta '64207' è' CallbackManagerImpl.RequestCodeOffset.Share.toRequestCode() '. –