| 14792 |
manas |
1 |
package com.facebook;
|
|
|
2 |
|
|
|
3 |
import android.content.BroadcastReceiver;
|
|
|
4 |
import android.content.Context;
|
|
|
5 |
import android.content.Intent;
|
|
|
6 |
import android.os.Bundle;
|
|
|
7 |
import com.facebook.internal.NativeProtocol;
|
|
|
8 |
|
|
|
9 |
/**
|
|
|
10 |
* This class implements a simple BroadcastReceiver designed to listen for broadcast notifications from the
|
|
|
11 |
* Facebook app. At present, these notifications consistent of success/failure notifications for photo upload
|
|
|
12 |
* operations that happen in the background.
|
|
|
13 |
*
|
|
|
14 |
* Applications may subclass this class and register it in their AndroidManifest.xml, listening on the
|
|
|
15 |
* com.facebook.platform.AppCallResultBroadcast action.
|
|
|
16 |
*/
|
|
|
17 |
public class FacebookBroadcastReceiver extends BroadcastReceiver {
|
|
|
18 |
|
|
|
19 |
@Override
|
|
|
20 |
public void onReceive(Context context, Intent intent) {
|
|
|
21 |
String appCallId = intent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID);
|
|
|
22 |
String action = intent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION);
|
|
|
23 |
if (appCallId != null && action != null) {
|
|
|
24 |
Bundle extras = intent.getExtras();
|
|
|
25 |
|
|
|
26 |
if (NativeProtocol.isErrorResult(intent)) {
|
|
|
27 |
onFailedAppCall(appCallId, action, extras);
|
|
|
28 |
} else {
|
|
|
29 |
onSuccessfulAppCall(appCallId, action, extras);
|
|
|
30 |
}
|
|
|
31 |
}
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
protected void onSuccessfulAppCall(String appCallId, String action, Bundle extras) {
|
|
|
35 |
// Default does nothing.
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
protected void onFailedAppCall(String appCallId, String action, Bundle extras) {
|
|
|
39 |
// Default does nothing.
|
|
|
40 |
}
|
|
|
41 |
}
|