Skip to content

Commit

Permalink
test add pending intent
Browse files Browse the repository at this point in the history
  • Loading branch information
oranedir committed May 12, 2022
1 parent a33acbb commit 07bf05f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/android/com/gae/scaffolder/plugin/FCMPluginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

public class FCMPluginActivity extends Activity {
private static String TAG = "FCMPlugin";
private PendingIntent pendingIntent = null;

/*
* this activity will be started if the user touches a notification that we own.
Expand All @@ -31,6 +32,7 @@ public void onCreate(Bundle savedInstanceState) {

private void sendPushPayload() {
Bundle intentExtras = getIntent().getExtras();

if(intentExtras == null) {
return;
}
Expand All @@ -49,6 +51,13 @@ private void sendPushPayload() {
private void forceMainActivityReload() {
PackageManager pm = getPackageManager();
Intent launchIntent = pm.getLaunchIntentForPackage(getApplicationContext().getPackageName());
/*if (Build.ver) launchIntent.addFlags(PendingIntent.FLAG_UPDATE_CURRENT |
PendingIntent.FLAG_MUTABLE);*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
this.pendingIntent = PendingIntent.getActivity(activity.getActivity(), 0, launchIntent, PendingIntent.FLAG_MUTABLE);
} else {
this.pendingIntent = PendingIntent.getActivity(activity.getActivity(), 0, launchIntent, PendingIntent.FLAG_UPDATE_CURRENT);
}
startActivity(launchIntent);
}

Expand Down

0 comments on commit 07bf05f

Please sign in to comment.