question

Oral avatar image
Oral asked ·

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 characters needed characters left characters exceeded

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

ever get this working?

0 Likes 0 · ·

1 Answer

Chanel avatar image
Chanel 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>
Share
10 |2000 characters needed characters left characters exceeded

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