Comments (5)
I forgot to comment, that the call to PushNotificationManager.ProcessIntent (Intent);
I do not do it in the main activity since this is of type MvxSplashScreenActivity
. This call I make in a second activity after initializing Xamarin.Forms and loading the application.
from pushnotificationplugin.
Check the FAQ section to fix your issue:
https://github.com/CrossGeeks/PushNotificationPlugin/blob/master/docs/FAQ.md
Also the ProcessIntent call should be done on your MainLauncher activity so if you have a splash that might be were you need to do that call
from pushnotificationplugin.
@sergio11
This is actually the result of a known Xamarin.Android bug and not of this library.
For more details see this thread.
Try cleaning your solution and your Xamarin.Android project and building again.
Also you can try the workaround as described in comment 13 of the bug report.
from pushnotificationplugin.
Thank you so much,
it seems that my problem was that I needed to add
<Target Name="RemoveGoogleServicesJsonStampFiles" BeforeTargets="BeforeBuild">
<Delete Files="$(IntermediateOutputPath)\ProcessGoogleServicesJson.stamp" />
</Target>
to my Android project file.
Now works perfect.
from pushnotificationplugin.
I've got it working in an application similar to the example. It works perfect. The problem is when I have a main activity of type SplashScreen.
[Activity(
Name = "com.usal.bisite.bulltect.SplashScreen",
Label = "bulltect"
, MainLauncher = true
, Icon = "@mipmap/ic_launcher"
, Theme = "@style/Theme.Splash"
, NoHistory = true
, ScreenOrientation = ScreenOrientation.Portrait)]
public class SplashScreen : MvxSplashScreenActivity
{
protected override void TriggerFirstNavigate()
{
StartActivity(typeof(MvxFormsApplicationActivity));
}
}
which then initiates another activity where Xamarin Forms is initialized and the application:
[Activity(
Name = "com.usal.bisite.bulltect.MvxFormsApplicationActivity",
Label = "bulltect",
Icon = "@mipmap/ic_launcher",
Theme = "@style/AppTheme",
MainLauncher = false,
LaunchMode = LaunchMode.SingleTask,
ScreenOrientation = ScreenOrientation.Portrait
)]
public class MvxFormsApplicationActivity : FormsAppCompatActivity
{
MvxFormsApplication _formsApplication;
protected MvxFormsApplication FormsApplication
{
get
{
if (_formsApplication == null)
{
var formsPresenter = (IMvxFormsPagePresenter)Mvx.Resolve<IMvxAndroidViewPresenter>();
_formsApplication = formsPresenter.FormsApplication;
}
return _formsApplication;
}
}
protected override void OnCreate(Bundle bundle)
{
try
{
ToolbarResource = Resource.Layout.Toolbar;
TabLayoutResource = Resource.Layout.Tabs;
base.OnCreate(bundle);
// Required for proper Push notifications handling
var setupSingleton = MvxAndroidSetupSingleton.EnsureSingletonAvailable(ApplicationContext);
setupSingleton.EnsureInitialized();
global::Xamarin.Forms.Forms.Init(this, bundle);
GrialKit.Init(this, "Bullytect.Droid.GrialLicense");
// Presenters Initialization
global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, bundle);
// Xamarin.Auth CustomTabs Initialization/Customisation
global::Xamarin.Auth.CustomTabsConfiguration.ActionLabel = null;
global::Xamarin.Auth.CustomTabsConfiguration.MenuItemTitle = null;
global::Xamarin.Auth.CustomTabsConfiguration.AreAnimationsUsed = true;
global::Xamarin.Auth.CustomTabsConfiguration.IsShowTitleUsed = false;
global::Xamarin.Auth.CustomTabsConfiguration.IsUrlBarHidingUsed = false;
global::Xamarin.Auth.CustomTabsConfiguration.IsCloseButtonIconUsed = false;
global::Xamarin.Auth.CustomTabsConfiguration.IsActionButtonUsed = false;
global::Xamarin.Auth.CustomTabsConfiguration.IsActionBarToolbarIconUsed = false;
global::Xamarin.Auth.CustomTabsConfiguration.IsDefaultShareMenuItemUsed = false;
global::Android.Graphics.Color color_xamarin_blue;
color_xamarin_blue = new global::Android.Graphics.Color(0x34, 0x98, 0xdb);
global::Xamarin.Auth.CustomTabsConfiguration.ToolbarColor = color_xamarin_blue;
// ActivityFlags for tweaking closing of CustomTabs
// please report findings!
global::Xamarin.Auth.CustomTabsConfiguration.
ActivityFlags =
global::Android.Content.ActivityFlags.NoHistory
|
global::Android.Content.ActivityFlags.SingleTop
|
global::Android.Content.ActivityFlags.NewTask
;
global::Xamarin.Auth.CustomTabsConfiguration.IsWarmUpUsed = true;
global::Xamarin.Auth.CustomTabsConfiguration.IsPrefetchUsed = true;
UserDialogs.Init(this);
PullToRefreshLayoutRenderer.Init();
XFGloss.Droid.Library.Init(this, bundle);
//Initializing FFImageLoading
CachedImageRenderer.Init();
CarouselViewRenderer.Init();
FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects));
LoadApplication(FormsApplication);
PushNotificationManager.ProcessIntent(Intent);
var starter = Mvx.Resolve<IMvxAppStart>();
starter.Start();
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("**BullTect LAUNCH EXCEPTION**\n\n" + e);
}
}
public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
{
base.OnConfigurationChanged(newConfig);
DeviceOrientationLocator.NotifyOrientationChanged();
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}
I have placed the call PushNotificationManager.ProcessIntent (Intent);
in both activities. But it does not work. When I send the notification to the device the first time it tells me that it has been sent correctly. The next few times tell me ""error": "NotRegistered""
Would you know what the problem might be?
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.