我有一个应用程序,它有一个接收动作 ACTION_NEW_PICTURE 的广播接收器。该接收器在大多数设备上都可以正常工作,除了带有 htc 和三星相机 UI 的设备。
这是我的接收器:
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
// Log.e(TAG, "Intent Received");
// Toast.makeText(Helper.this, "Intent Received",
// Toast.LENGTH_SHORT).show();
if (intent.getAction() == android.hardware.Camera.ACTION_NEW_PICTURE) {
NameEditor.mediaType = "image";
} else {
if (intent.getAction() == android.hardware.Camera.ACTION_NEW_VIDEO) {
NameEditor.mediaType = "video";
}
}
NameEditor.pictureUri = intent.getData();
startActivity(dIntent);
}
};
filter = new IntentFilter(android.hardware.Camera.ACTION_NEW_PICTURE);
filter.addAction(android.hardware.Camera.ACTION_NEW_VIDEO);
try {
filter.addDataType("image/*");
filter.addDataType("video/*");
} catch (MalformedMimeTypeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
registerReceiver(receiver, filter);
有人可以帮我解决这个问题吗?