1. Download our Official Android App: Forums for Android!

Intent for New Photo

Discussion in 'Android Apps & Games' started by sivaprakash, Jul 29, 2011.

  1. sivaprakash

    sivaprakash Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    6
    Joined:
    Jan 10, 2011

    Jan 10, 2011
    6
    0
    5
    Hi

    I want to receive a broadcast message whenever a new photo is taken. I have tried with the following intent filter in the configuration but none of them captured the intent. Can you please tell me what intent I have to capture.

    Code (Text):
    1.  
    2.  
    3. <receiver android:name=".BroadReceiver">
    4.             <intent-filter>
    5.                 <action android:name="com.android.camera.NEW_PICTURE"></action>
    6.             </intent-filter>
    7.         </receiver>
    8.  
    9.  
     

    Advertisement

  2. alostpacket

    alostpacket Over Macho Grande?
    Rank:
    None
    Points:
    513
    Posts:
    7,972
    Joined:
    Nov 29, 2009

    Nov 29, 2009
    7,972
    3,603
    513
    Android App Developer
    NY
    Welcome to AF!

    Do you have the camera permission?

    Can you post the BroadReceiver class?
     
  3. sivaprakash

    sivaprakash Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    6
    Joined:
    Jan 10, 2011

    Jan 10, 2011
    6
    0
    5
    Hi


    Thanks !! Here is the BroadReceiver class


    Code (Text):
    1.  
    2.  
    3. public class BroadReceiver extends BroadcastReceiver{
    4.  
    5.     @Override
    6.     public void onReceive(Context context, Intent arg1) {
    7.        
    8.        
    9.         Toast.makeText(context, "It's working!", 10).show();
    10.         Log.d("BroadReceiver", "Received ..... ");
    11.        
    12.         context.startService(new Intent (context, BgService.class));
    13.        
    14.        
    15.     }
    16.  
    17. }
    18.  
    19. Permission in Manifest file:-
    20.  
    21. <uses-permission android:name="android.permission.CAMERA"></uses-permission>
    22.  
    23.  
    24.  
     
  4. sivaprakash

    sivaprakash Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    6
    Joined:
    Jan 10, 2011

    Jan 10, 2011
    6
    0
    5
    I got this worked,


    Code (Text):
    1.  
    2.  
    3. <intent-filter>
    4.                 <action android:name="com.android.camera.NEW_PICTURE"/>
    5.                 <data android:mimeType="image/*"/>
    6.             </intent-filter>
    7.  
    8. <uses-permission android:name="android.permission.CAMERA"></uses-permission>
    9.  
     

Share This Page

Loading...