我正在开发基于WiFi的文件共享项目。此项目适用于除Samsung Devices之外的所有设备。这是我的代码。
public class MainReceiver extends BroadcastReceiver {
private static final String TAG = MainReceiver.class.getName();
public static final String ACTION_TRANSFER_DONE = "action_transfer_done";
private MainActivity mActivity;
public MainReceiver(){
super();
}
public MainReceiver(MainActivity activity){
super();
mActivity = activity;
}
@Override
public void onReceive(Context context, Intent intent)
{
if (intent.getAction().toString().equalsIgnoreCase("action_transfer_done"))
{
Log.d(TAG, "transfer done");
List<String> mFileNames = intent.getStringArrayListExtra(ServerService.FILES_NAME);
mActivity.transferDone(mFileNames);
}
}
}