Reputation: 1
Can anybody help me please? My question is that how to to display popup message on camera image capture using broadcast receiver.
I have register Receiver but it is not working.
Receiver class:
public class CameraReciver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Log.i("INFO", "Enter BroadcastReceiver");
Cursor cursor = context.getContentResolver().query(intent.getData(),
null, null, null, null);
cursor.moveToFirst();
String image_path = cursor.getString(cursor.getColumnIndex("_data"));
Toast.makeText(context, "New Photo is Saved as : " + image_path,Toast.LENGTH_LONG).show();
}
}
Manifest file:
<receiver
android:name="com.example.abdullahnawaz.mycamera.CameraReciver"
android:enabled="true" >
<intent-filter>
<action android:name="com.android.camera.NEW_PICTURE" />
<data android:mimeType="image/*" />
<action android:name="android.intent.action.CAMERA_BUTTON" />
</intent-filter>
</receiver>
Upvotes: 0
Views: 1977
Reputation: 895
Starting from Android 7.0, please use JobInfo.Builder.addTriggerContentUri().
For older devices, you can listen to the ACTION_NEW_PICTURE or ACTION_NEW_VIDEO broadcast. These broadcasts are no long sent on 7.0 and above.
Upvotes: 2