question

oral avatar image
oral asked thedangler commented

we want to launch our app which is not happening in BroadcastReceiver onReceive Method (i.e ACTION_PAYMENT_PROCESSED)

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.
Broadcastslifecycle
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

thedangler avatar image thedangler commented ·

ever get this working?

0 Likes 0 ·

1 Answer

chanel avatar image
chanel Deactivated answered
It sounds like you may be missing the following from your AndroidManifest. Please let me know if this change doesn't work for you.

<receiver android:enabled="true" android:name=".MyReceieverr">
    <intent-filter>
        <action android:name="com.clover.intent.action.PAYMENT_PROCESSED" />
    </intent-filter>
</receiver>
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community