I am having difficulty getting a BroadcastReceiver to process my IntentService response. The service processes multiple different actions and returns an action type. The receiver will never seem to pick it up, however. The intent does get called as I can debug and set a breakpoint in the IntentService and see the action get processed successfully. I just never see the textbox updated with the appropriate data or see the BroadcastReceiver evein being called.
IntentService
protected void onHandleIntent(Intent intent) {
String action = intent.getAction();
// Data the service was called with.
Bundle incomingData = intent.getExtras();
String key = incomingData.getString(KEY_APPKEY);
String secret = incomingData.getString(KEY_SECRET);
String collection = incomingData.getString(KEY_COLLECTION);
CheckinManager cm = new CheckinManager(this.getApplicationContext(),key,secret,collection);
Intent broadcastIntent = new Intent();
broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT);
if (action == ACTION_GET_POI) {
Double lat = incomingData.getDouble(KEY_LATITUDE);
Double lon = incomingData.getDouble(KEY_LONGITUDE);
ArrayList<POI> nearbyPOIs = new ArrayList<POI>();
//broadcastIntent.setAction(ACTION_GET_POI_PROCESSED);
broadcastIntent.setAction("com.msalinger.checkinmanager.CheckinService.getPOIProcessed");
try {
nearbyPOIs = cm.getPOI(lat, lon);
broadcastIntent.putExtra(OUT_KEY_RESULT, true);
broadcastIntent.putExtra(OUT_KEY_ERROR, "");
broadcastIntent.putParcelableArrayListExtra(OUT_KEY_POILIST, nearbyPOIs);
} catch (JSONException ex) {
Log.d(TAG,ex.getMessage() + "\n" + ex.getStackTrace());
broadcastIntent.putExtra(OUT_KEY_RESULT, false);
broadcastIntent.putExtra(OUT_KEY_ERROR, ex.getMessage());
}
}
else if (action == ACTION_CHECK_IN) {
// Do something
}
else if (action == ACTION_GET_CHECKINS) {
// Do Something
}
else if (action == ACTION_FIND_NEARBY_POIS_WITH_CHECKINS) {
// Do Something
}
sendBroadcast(broadcastIntent);
}
Broadcast Receiver as sub-class of Main Activity
public class CheckinReceiver extends BroadcastReceiver {
private final static String INTENT_BASE_URI = "com.msalinger.checkinmanager.CheckinService";
private final static String ACTION_GET_POI_PROCESSED = ".getPOIProcessed";
private final static String ACTION_CHECK_IN_PROCESSED = ".checkInProcessed";
private final static String ACTION_GET_CHECKINS_PROCESSED = ".getCheckinsProcessed";
private final static String ACTION_FIND_NEARBY_POIS_WITH_CHECKINS_PROCESSED = ".findNearbyPOIsWithCheckinsProcessed";
#Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("com.msalinger.checkinmanager.CheckinService.getPOIProcessed")) {
tv = (TextView)findViewById(R.id.textBox1);
Bundle incomingData = intent.getExtras();
String st = "";
if (incomingData.getBoolean("result")) {
ArrayList<POI> poiList = incomingData.getParcelableArrayList("poList");
st = printPOI(poiList);
}
else {
st = incomingData.getString("error");
}
}
else if (intent.getAction().equals(INTENT_BASE_URI + ACTION_CHECK_IN_PROCESSED)) {
}
else if (intent.getAction().equals(INTENT_BASE_URI + ACTION_GET_CHECKINS_PROCESSED)) {
}
else if (intent.getAction().equals(INTENT_BASE_URI + ACTION_FIND_NEARBY_POIS_WITH_CHECKINS_PROCESSED)) {
}
}
}
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.msalinger.checkinmanagerdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:enabled="true"
android:name="com.msalinger.checkinmanager.CheckinService" />
<receiver
android:name=".CheckinReceiver">
<intent-filter>
<action android:name="com.msalinger.checkinmanager.CheckinService.getPOIProcessed" />
</intent-filter>
<intent-filter>
<action android:name="com.msalinger.checkinmanager.CheckinService.checkInProcessed" />
</intent-filter>
<intent-filter>
<action android:name="com.msalinger.checkinmanager.CheckinService.getCheckinsProcessed" />
</intent-filter>
<intent-filter>
<action android:name="com.msalinger.checkinmanager.CheckinService.findNearbyPOIsWithCheckinsProcessed" />
</intent-filter>
</receiver>
</application>
</manifest>
What am I doing wrong? Note that the IntentService exists as part of an Android class library with a different package than the Main activity.
Because the receiver exists to update data in the activity, it should be registered when the activity resume and unregistered when the activity pause. And it should not be in the manifest (see the doc for this).
If it's not the case, it shouldn't be a subclass of your activity.
In all cases, I think your Receiver is not called because it has not the right name in the manifest. It may be something like this : .MainActivity$CheckinReceiver.
Related
Good evening community, I am reaching with the hopes of being educated about the following problem.
My intention with this code is to be able to handle USB permission intents in a receiver registered in a manifest file. The receiver gets USB Attached and detached actions, but not USB permissions when the user either accepts or declines the prompt.
Here is the code for the manifest, receiver and an activity to send the permissions request to the USB manager. And Finally, my target SDK is 28.
Any help is very much appreciated. Thank you very much.
public class BroadcastReceiver extends android.content.BroadcastReceiver{
public static final String USB_DEVICE_ATTACHED = "android.hardware.usb.action.USB_DEVICE_ATTACHED";
public static final String USB_DEVICE_DETACHED = "android.hardware.usb.action.USB_DEVICE_DETACHED";
public static final String USB_PERMISSION ="com.android.example.USB_PERMISSION";
#Override
public void onReceive(Context context, Intent intent) {
Context applicationContext = context.getApplicationContext();
try{
if (intent != null) {
String action = intent.getAction();
if (!TextUtils.isEmpty(action)) {
if (action.equals(USB_DEVICE_ATTACHED) || action.equals(USB_PERMISSION)){
UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
UsbManager usbManager = (UsbManager) applicationContext.getSystemService(Context.USB_SERVICE);
if (action.equals(USB_DEVICE_ATTACHED)){
if (!usbManager.hasPermission(device)){
intent.setAction(USB_PERMISSION);
intent.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false);
intent.setClass(applicationContext, PermissionActivity.class);
applicationContext.startActivity(intent);
Toast.makeText(applicationContext, "Device Attached.", Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(applicationContext, "Permissions already assigned", Toast.LENGTH_LONG).show();
}
}
else if (action.equals(USB_PERMISSION)){
if (usbManager.hasPermission(device)){
Toast.makeText(applicationContext, "USB Permissions are granted.", Toast.LENGTH_LONG).show();
}
}
}
else if (action.equals(USB_DEVICE_DETACHED)) {
Toast.makeText(applicationContext, "Device Detached.", Toast.LENGTH_LONG).show();
}
}
}
}
catch(Exception e){
Toast.makeText(applicationContext, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
Here is the activity:
public class PermissionActivity extends android.support.v7.app.AppCompatActivity {
public static final String USB_PERMISSION ="com.android.example.USB_PERMISSION";
#Override
protected void onStart() {
super.onStart();
}
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Context applicationContext = this.getApplicationContext();
Intent intent = getIntent();
if (intent != null )
{
if (intent.getAction().equals(USB_PERMISSION)){
if (!intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false )) {
UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (device != null) {
UsbManager mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
PendingIntent mPermissionIntent = PendingIntent.getBroadcast(applicationContext, 0, new Intent(USB_PERMISSION), 0);
mUsbManager.requestPermission(device, mPermissionIntent);
Toast.makeText(applicationContext, "Requesting Permission", Toast.LENGTH_LONG).show();
}
}
}
}
finish();
}
#Override
protected void onResume() {
super.onResume();
}
}
And finally, the manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.user.usbtest">
<uses-feature android:name="android.hardware.usb.host"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PermissionActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:excludeFromRecents="true"
android:exported="true"
android:noHistory="true"
android:process=":UsbEventReceiverActivityProcess"
android:taskAffinity="com.example.taskAffinityUsbEventReceiver"
android:theme="#style/Theme.AppCompat.Translucent">
<intent-filter>
<action android:name="com.android.example.USB_PERMISSION"/>
</intent-filter>
</activity>
<receiver android:name=".BroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"/>
<action android:name="com.android.example.USB_PERMISSION"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
</manifest>
I found the problem. Since Android 8.0, there are more restrictions with manifest-declared
broadcast receivers and the type of actions that can be received. The USB Permissions action is not part of the limited list of actions that can be received. Here are some links regarding this issue.
https://developer.android.com/guide/components/broadcasts#context-registered-recievers
https://developer.android.com/guide/components/broadcast-exceptions
Android launch application multiple times on an NFC tag discovered. I tried using the answer in this link Android launch activity multiple times on an NFC tag. but it says resources not found.
I am reading the tag from a fragment. Any help.
This is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.atsl.touch">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:launchMode= "singleInstance"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
this is my fragments onResume()
public void onResume() {
super.onResume();
Intent intent =getActivity().getIntent();
pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, 0);
intentFilter = new IntentFilter[] { };
nfcAdapter = NfcAdapter.getDefaultAdapter(getContext());
String action = intent.getAction();
boolean cardMatched=false;
Tag tag=null;
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
Toast.makeText(getContext(),"Blahhhhh",Toast.LENGTH_LONG).show();
tag = (Tag)intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
tappedCard=new Card();
tappedCard.setCardId(MainActivity.bytesToHexString(tag.getId()));
//tag = (Tag)intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
String[] techList = tag.getTechList();
////////////+___________________________________________
////////////+___________________________________________
if(tag == null){
Toast.makeText(getContext(), "tag == null",Toast.LENGTH_SHORT).show();
}else{
Card cc=new Card();
String tagId= MainActivity.bytesToHexString(tag.getId());
cc.setCardId(tagId);
dbHelper=new DBHelper(getContext());
ArrayList<Card> checkList=dbHelper.getAllCards();
if(checkList.size()>0)
{
for(Card d:checkList)
{
if (cc.equals(d))
{
cardMatched=true;
Toast.makeText(getContext(), "Card Matched !!!!",Toast.LENGTH_SHORT).show();
showCardDetails(cc.getCardId());
break;
}
else
{
continue;
}
}
if (!cardMatched)
{
imgBusCard.setVisibility(View.GONE);
showDetails.setVisibility(View.VISIBLE);
Toast.makeText(getContext(), "Card Not Matched !!!!",Toast.LENGTH_SHORT).show();
CustomDialogAddCard customDialogAddCard =new CustomDialogAddCard(getActivity(),"T",cc);
customDialogAddCard.show();
showCardDetails(cc.getCardId());
}
}
else {
Toast.makeText(getContext(), "No cards found !!!!",Toast.LENGTH_SHORT).show();
CustomDialogAddCard customDialogAddCard =new CustomDialogAddCard(getActivity(),"T",cc);
customDialogAddCard.show();
showCardDetails(cc.getCardId());
}
}
}else{
Toast.makeText(getContext(),
"onResume() : " + action,
Toast.LENGTH_SHORT).show();
}
}
The problem is when i run the application and hold an nfc tag near the phone app starts a new instance of the application. it doesn't detect the tag in the initial instance.
This question already has answers here:
How to use NFC ACTIONS
(5 answers)
Closed 3 years ago.
I'm creating application that do some action if hit NFC chip , I know the following information about NFC in Android please correct me if I am wrong
you can't register actions of the NFC to receiver in the manifest file , only activities .
each NFC chip has it's own unique id .
what I want to do is
while the Application is in the background or it's closed , if I hit NFC chip with id (ex 1234) my app lunched and do some action.
is that possible ?
if yes, how it can be achieved?
edit
here is my code , it does open when you check any NFC chip and get this action android.nfc.action.TECH_DISCOVERED
but when it open the action is android.intent.action.MAIN
MainActivity.java
public class MainActivity extends AppCompatActivity {
public static final String ACTION_CHECK_IN= "checked";
public static final String ACTION_CHECK_OUT= "unchecked";
private NfcAdapter mNfcAdapter;
boolean isCheckedIn = false;
private static final String TAG = "MainActivity";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
isCheckedIn = Pref.getBoolean("check", false);
}
#Override
protected void onResume() {
super.onResume();
Log.d(TAG, "onResume() called with: " + "");
String action = getIntent().getAction();
if (action != null) {
Log.d("MainActivity", "onCreate(" + action + ")");
if (action.equals(NfcAdapter.ACTION_NDEF_DISCOVERED) || action.equals(NfcAdapter.ACTION_TAG_DISCOVERED) || action.equals(NfcAdapter.ACTION_TECH_DISCOVERED)) {
if (!isCheckedIn) {
isCheckedIn = true;
Pref.putBoolean("check", true);
Log.d("checking","IN");
} else {
isCheckedIn = false;
Pref.putBoolean("check", false);
Log.d("checking","Out");
}
}
}
if (!mNfcAdapter.isEnabled()) {
Toast.makeText(MainActivity.this, "Please open it ", Toast.LENGTH_SHORT).show();
}
/**
* It's important, that the activity is in the foreground.
* Otherwise an IllegalStateException is thrown.
*/
setupForegroundDispatch(this, mNfcAdapter);
}
#Override
protected void onPause() {
/**
* Call this before onPause, otherwise an IllegalArgumentException is thrown.
*/
stopForegroundDispatch(this, mNfcAdapter);
super.onPause();
}
#Override
protected void onDestroy() {
super.onDestroy();
}
public static void setupForegroundDispatch(Activity activity, NfcAdapter adapter) {
final Intent intent = new Intent(activity.getApplicationContext(), activity.getClass());
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
final PendingIntent pendingIntent = PendingIntent.getActivity(
activity.getApplicationContext(), 0, intent, 0);
IntentFilter[] filters = new IntentFilter[2];
String[][] techList = new String[][]{};
// same filter as manifest - action, category
filters[0] = new IntentFilter();
filters[0].addAction(NfcAdapter.ACTION_TAG_DISCOVERED);
filters[1] = new IntentFilter();
filters[1].addAction(NfcAdapter.ACTION_TECH_DISCOVERED);
adapter.enableForegroundDispatch(activity, pendingIntent, filters, techList);
}
public static void stopForegroundDispatch(Activity activity, NfcAdapter adapter) {
adapter.disableForegroundDispatch(activity);
}
}
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.srjo.pocnfcadapter">
<uses-permission android:name="android.permission.NFC" />
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/filter_nfc" />
</activity>
</application>
</manifest>
According the the Android Developer site, it is possible for your app to filter NFC intents such as ACTION_NDEF_DISCOVERED.
First register your app in the manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.survivingwithandroid.nfc" >
....
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain"/>
</intent-filter>
<manifest>
Then you should use foreground dispatch (foreground app). Finally you use NFCAdapter to read the content (onNewIntent).
I wrote a detailed posts about NFC if you like give a look.
When phone state is ringing, I want to run an activity to show my own screen.
I'm using:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
and
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
but notification bar does not hide when activity is shown.
Go through following code snippets:
Create a BroadCastReceiver Class to listen to incoming calls with
the highest priority:
Manifest.xml:
<receiver android:name=".MyPhoneBroadcastReceiver">
<intent-filter android:priority="99999">
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
Then in class, onReceive() method opens the CustomCallsReceiver Activity with intent action is "android.intent.action.ANSWER"
#Override
public void onReceive(final Context context, Intent intent) {
Bundle extras = intent.getExtras();
if (extras != null) {
String state = extras.getString(TelephonyManager.EXTRA_STATE);
final String incomingNumber = extras.getString("incoming_number");
Handler callActionHandler = new Handler();
Runnable runRingingActivity = new Runnable(){
#Override
public void run() {
//Notice the intent, cos u will add intent filter for your class(CustomCallsReceiver)
Intent intentPhoneCall = new Intent("android.intent.action.ANSWER");
intentPhoneCall.putExtra("INCOMING_NUM", incomingNumber);
intentPhoneCall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intentPhoneCall);
}
};
if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
//increase the delay amount if problem occur something like -the screen didn't show up- that's the key about this method(the delay).
callActionHandler.postDelayed(runRingingActivity, 100);
}
if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
callActionHandler.removeCallbacks(runRingingActivity);
}
}
}
Add this intent filter in to manifest file for the class you will
use as a Custom call receiver.
<activity android:name="CustomCallsReceiver" android:noHistory="true" android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.ANSWER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
The CustomeCallsReceiver Class:
public class CustomCallsReceiver extends Activity {
private String TAG = "CustomCallsReceiver";
String incomingNumber, caller;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.custome_calls_receiver);
TextView number = (TextView) findViewById(R.id.number);
number.setGravity(Gravity.CENTER);
incomingNumber = getIntent().getExtras().getString("INCOMING_NUM");
caller = getCallerName(incomingNumber);
if (caller != null) {
number.setText(caller + "\n" + incomingNumber); }
}
And finally of course don't forget to add the Theme for not title or
notification bar at the manifest file
<application
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
Hope this working for you...
In my i have a receiver to predict incoming calls,Once i have the call i need bring my app to front of screen(Over call accept and reject scree), the code for receiver is shown below,
public class IncomingCallReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
if(null == bundle)
return;
Log.i("IncomingCallReceiver",bundle.toString());
String state = bundle.getString(TelephonyManager.EXTRA_STATE);
Log.i("IncomingCallReceiver","State: "+ state);
if(state.equalsIgnoreCase(TelephonyManager.EXTRA_STATE_RINGING))
{
String phonenumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
Log.i("IncomingCallReceiver","Incomng Number: " + phonenumber);
String info = "Detect Calls sample application\nIncoming number: " + phonenumber;
Intent intent2open = new Intent(context, com.varma.samples.detectcalls.ui.MainActivity.class);
intent2open.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent2open.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
String name = "KEY";
String value = "String you want to pass";
intent2open.putExtra(name, value);
context.startActivity(intent2open);
Toast.makeText(context, info, Toast.LENGTH_LONG).show();
}
}
}
in my manifest i added following parameters,
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="com.varma.samples.detectcalls.ui.MainActivity"
android:label="#string/app_name" android:launchMode="singleTop" android:taskAffinity="#android:string/no">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="com.varma.samples.detectcalls.receivers.OutgoingCallReceiver">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter>
</receiver>
<receiver android:name="com.varma.samples.detectcalls.receivers.IncomingCallReceiver">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"/>
</intent-filter>
</receiver>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
But when i launch the activity the receiver is started to listen incoming calls,then i close all instance of app in Settings, when call is coming for first time, my app is bring front over answer & reject screen.
Then i push back button to reject my call. Then when i make a call again the activity was not bring in front of my dialing screen. I don`t know where is the problem.