Cannot redirect Push notification when clicked to the APP
firmandev opened this issue · comments
Bug description:
To Reproduce:
Expected behavior:
Environment:
in every environment
** My Guess **
PendingIntent getLogPendingIntent() {
if (mContentIntent == null) {
mContentIntent = new Intent(getBaseContext(), Intent.class);
}
//intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
return PendingIntent.getActivity(this, 0, mContentIntent, PendingIntent.FLAG_MUTABLE);
}
this is the problem, but i dunno what to change the Intent.class
This line of code is used to open the MainActivity of the App.
Please check your AndroidManifest.xml
You should use v2.0.0, or modify the old code yourself
ohh i think i understand why it didnt work in your v.2.0.0, i have used it anyway but not working it is because of the name of my AndroidManifest, i have reconfig again, but still not working, it is cause you call the AndroidManifext in example folder ?
react folder is not in node modules, how to reconfig that ?
this is how to reproduce, create new react native then install it using npm, it will behave different, even you reconfig the OpenVPNService.java
i even concat it manual like this still not working
intent.setComponent(new ComponentName(this, "myPackagesName.MainApplication"));
Okay this is my conclusion, thanks for your inspiration
THIS IS WORKING, I HAVE TESTED IT, if you want to redirect to your MainApplication, use this function.
PendingIntent getGraphPendingIntent() {
String packageName = getApplicationContext().getPackageName();
if (mContentIntent == null) {
mContentIntent = getPackageManager().getLaunchIntentForPackage(packageName);
}
//intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
return PendingIntent.getActivity(this, 0, mContentIntent, PendingIntent.FLAG_MUTABLE);
}
and in showNotification method
find this
nbuilder.setContentIntent
replace full row to this
nbuilder.setContentIntent(getGraphPendingIntent());