0

I have managed to put a broadcast receiver from the manifest file, it looks like this:

    <receiver android:name=".BReceivers.CallBReciever">
        <intent-filter>
            <action android:name="android.intent.action.PHONE_STATE" />
        </intent-filter>
    </receiver>

Now what i am trying to do is to take it out of the manifest and start it only when the user presses a certain button, which should look somethings like this:

        Button start = (Button) findViewById(R.id.Button_Start);

        start.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {


                    @Override
                    public void onReceive(Context context, Intent arg1) {
                        Log.d("aaa", "bbb");
                        switch (getResultCode())
                        {

                        }
                    }
                }, new IntentFilter(Intent.ACTION_CALL));


            }
        }
    });

But i don't get into the receiver, any idea why? what IntentFilter String param should i use?

user733284
  • 925
  • 2
  • 11
  • 18

1 Answers1

2

You have to implement phone state listener to listen your call state

for more information refer this

Community
  • 1
  • 1
Dharmendra
  • 33,296
  • 22
  • 86
  • 129