We are using the BroadcastReceiver to capture IntentFilter(Intents.ACTION_PAYMENT_PROCESSED); event. The event is captured successfully and we receive the payment processing results using the method onReceive(Context context, Intent intent).
At this point we want to launch our app which is not happening. Please check the code below
--------------------------------
public class MainActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
if (mAccount == null) {
mAccount = CloverAccount.getAccount(this);
if (mAccount == null) {
return;
}
}
connect();
this.registerReceiver(br, new IntentFilter(Intents.ACTION_PAYMENT_PROCESSED));
}
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(Intents.ACTION_PAYMENT_PROCESSED)) {
Intent startIntent = context
.getPackageManager()
.getLaunchIntentForPackage(context.getPackageName());
startIntent.setFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT |
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT |
Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
);
context.startActivity(startIntent);
}
}
}
}
----------------------------------
The code is neither throwing an exception nor launching our app.