Comments (32)
On your splash activity OnCreate try doing this:
[Activity(Theme = "@style/Theme.Splash",
MainLauncher = true,
NoHistory = true)]
public class SplashActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Create your application here
var mainIntent = new Intent(Application.Context, typeof(MainActivity));
if (Intent.Extras != null)
{
mainIntent.PutExtras(Intent.Extras);
}
mainIntent.SetFlags(ActivityFlags.SingleTop);
StartActivity(mainIntent);
}
}
from pushnotificationplugin.
Thanks @rdelrosario.
I followed the sample FirebasePushSample and worked!!
from pushnotificationplugin.
So to understand this. FirebasePushNotificationPlugin works when app is closed not this PushNotificationPlugin? Is it?
from pushnotificationplugin.
On your splash activity OnCreate try doing this:
[Activity(Theme = "@style/Theme.Splash", MainLauncher = true, NoHistory = true)] public class SplashActivity : Activity { protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here var mainIntent = new Intent(Application.Context, typeof(MainActivity)); if (Intent.Extras != null) { mainIntent.PutExtras(Intent.Extras); } mainIntent.SetFlags(ActivityFlags.SingleTop); StartActivity(mainIntent); } }
Thank you, this fixed my problem, but anyone who will try this solution, please note that if you ovverided OnResume, put this code inside onresume method
from pushnotificationplugin.
You need to navigate to the page you want once you receive the OnNotificationOpened event
from pushnotificationplugin.
Also where do you have the OnNotificationOpened event?
from pushnotificationplugin.
I have OnNotificationOpened event in App.xaml.cs in method OnStart. This method is implemented the navigation. But i want to implement to working in MainApplication too. Sorry for english.
from pushnotificationplugin.
Why you want to implement it on mainapplication?
from pushnotificationplugin.
Because when app is closed, the OnNotificationOpened event not working. What do i do for the event working with app closed?
from pushnotificationplugin.
OnNofiticationOpened should work just fine when application closed, did you call ProcessIntent on MainActivity OnCreate method and on OnNewIntent method
from pushnotificationplugin.
My MaincActivity:
[Activity(Label = "MusicScopeApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
DependencyService.Register<ToastNotification>();
ToastNotification.Init(this, new PlatformOptions() { SmallIconDrawable = Android.Resource.Drawable.IcDialogInfo });
IconControls.Init(Resource.Id.toolbar, Resource.Id.tabs);
FormsAppCompatActivity.ToolbarResource = Resource.Layout.toolbar;
FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs;
FlowListView.Init();
CachedImageRenderer.Init();
UserDialogs.Init(this);
PushNotificationManager.ProcessIntent(Intent);
LoadApplication(new App());
}
protected override void OnNewIntent(Intent intent)
{
base.OnNewIntent(intent);
PushNotificationManager.ProcessIntent(intent);
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Android.Content.PM.Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
protected override void OnActivityResult(int requestCode, Android.App.Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
InAppBillingImplementation.HandleActivityResult(requestCode, resultCode, data);
}
}
from pushnotificationplugin.
I have a SplashActivity. It's here:
[Activity(Theme = "@style/Theme.Splash",
MainLauncher = true,
NoHistory = true)]
public class SplashActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Create your application here
StartActivity(typeof(MainActivity));
}
}
from pushnotificationplugin.
Is it right?
from pushnotificationplugin.
@SkillerSKL Let me know if this worked for you.
from pushnotificationplugin.
Hi @rdelrosario,
Sorry for delay. Your solution didn't work :s
When tap in notiication open only a mainactivity but the event opened not fired.
from pushnotificationplugin.
Hi,
I have same problem,
help me !
from pushnotificationplugin.
Hi!
I have the same problem.
My version of xamarin is 2.5.0.77107 and I'm testing it in a sansung s7.
from pushnotificationplugin.
Try using:
https://www.nuget.org/packages/Plugin.PushNotification/1.2.0-beta
from pushnotificationplugin.
PushNotificationManager does not exist in the current context in MainActivity.
I have de using Plugin.PushNotification;
from pushnotificationplugin.
Did you check if Plugin.PushNotification is installed on the Android project references? After the update
from pushnotificationplugin.
Yes, I have the latest version installed on all projects, as you can see in the attached image.
It's normal when upgrading to the latest version if you uninstall the libraries you see in the other capture?
from pushnotificationplugin.
Hi guys are you still having issues?
I just released a new stable version of the plugin:
https://www.nuget.org/packages/Plugin.PushNotification/1.2.2
from pushnotificationplugin.
I continue with the same problem:
PushNotificationManager does not exist in the current context
The same thing also happens to me in the latest version of FirebasePushNotificationPlugin :(
from pushnotificationplugin.
Where are you trying to use this class? It only exists on Android and iOS projects not PCL
from pushnotificationplugin.
I use it only on Android and IOS projects.
Enclosed here is a classes view of the Android project:
As you can see, the PushNotificationManager class is missing :(
The same thing happens to me in the other plugin.
pd: I have tried it on different pcs.
from pushnotificationplugin.
I think this issue is in your environment. If you check the sample this doesn't happen it compiles correctly.
from pushnotificationplugin.
I've created an empty project with prism and this plugin and it's the same thing. :(
Did you try it?Will the nuget package be well generated?
from pushnotificationplugin.
Yes I tried the sample on this repo FirebasePushSample and compiles and works fine on Android and iOS.
from pushnotificationplugin.
OnNotificationOpened not working here yet. @rdelrosario , do you have any sample with this method working with app closed ?
from pushnotificationplugin.
The sample FirebasePushSample in the repo, OnNotificationOpened works when app is closed.
from pushnotificationplugin.
Yes I tried the sample on this repo FirebasePushSample and compiles and works fine on Android and iOS.
The example project works perfectly well for me, however upgrading from a previous version does not.
I have this problem on several pcs and it seems that there are more problems like mine.
from pushnotificationplugin.
I updated the plugin, let me know if still have issues with this.
If still have issues I would suggest first uninstall your current plugin version and then install the last one. Also confirm dependencies have the right version installed.
from pushnotificationplugin.
Related Issues (20)
- This plugin vs FirebasePushNotificationPlugin HOT 6
- Strange behaviour in IOS HOT 1
- Crash on iOS with version 3.6.9 when tapping notification HOT 2
- The Sample solution does not show the notification
- Initialization Exception in push notification plugin
- Is there possibility to only show specified by payload value on iOS?
- On iOS, "UNNotificationPresentationOptions.Sound" never turns off once it's been activated
- Android dependencies - Not receiving notifications on Android HOT 1
- Android DefaultPushNotificationHandler "silent" flag not case sensitive
- Why do we have to reset token during debug?
- Missing Xamarin.Firebase.Iid package referenced by this plugin HOT 2
- Icon problem
- Android 12 and missing android:exported attribute HOT 15
- iOS 15.4.1 don't open push notification HOT 2
- FirebaseApp is not initialized HOT 2
- .net6 and Maui support? HOT 2
- PNMessagingService Service class requires an Exported attribute starting from Android 12 HOT 1
- How to enable "CriticalAlert" using this plugin? HOT 1
- no valid “aps-environment” entitlement string found for application
- Is there any plan to release this Library for . NET MAUI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pushnotificationplugin.