In my application I want to send sms when user dialled a 000 number ,
so I have write following code.
my manifest.xml has

<receiver android:name="MyReceiver">
        <intent-filter>
                <action
android:name="android.intent.action.ACTION_CAMERA_BUTTON" />
         </intent-filter>
 </receiver>


I had given following permmisions

 <uses-permission android:name="android.permission.SEND_SMS">
    </uses-permission>

    <uses-permission android:name="android.permission.RECEIVE_SMS">
    </uses-permission>

    <uses-permission
android:name="android.permission.PROCESS_OUTGOING_CALLS">
    </uses-permission>

    <uses-permission android:name="android.permission.CALL_PHONE" />


MyReceiver class contains

public void onReceive(Context context, Intent intent)
{
      Intent myStarterIntent = new Intent(context,MicroERS2.class);
      myStarterIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      context.startActivity(myStarterIntent);
}


and my MicroERS2 contains

  public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        sendSMS("9960510915","Hi Pramod");
    }

    public  void sendSMS(String phoneNumber, String message)
    {
              //code to send sms
    }


when I pressed camera button sms will not be sent. But when I use
"ACTION_NEW_OUTGOING_CALL " insted of ACTION_CAMERA_BUTTON then sms
will not be sent on pressing call button . What is wrong in my code?

Please help me thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to