Giter Site home page Giter Site logo

Comments (32)

rdelrosario avatar rdelrosario commented on June 14, 2024 1

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.

SkillerSKL avatar SkillerSKL commented on June 14, 2024 1

Thanks @rdelrosario.
I followed the sample FirebasePushSample and worked!!

from pushnotificationplugin.

asanka-indrajith avatar asanka-indrajith commented on June 14, 2024 1

So to understand this. FirebasePushNotificationPlugin works when app is closed not this PushNotificationPlugin? Is it?

from pushnotificationplugin.

fm698 avatar fm698 commented on June 14, 2024 1

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.

rdelrosario avatar rdelrosario commented on June 14, 2024

You need to navigate to the page you want once you receive the OnNotificationOpened event

from pushnotificationplugin.

rdelrosario avatar rdelrosario commented on June 14, 2024

Also where do you have the OnNotificationOpened event?

from pushnotificationplugin.

SkillerSKL avatar SkillerSKL commented on June 14, 2024

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.

rdelrosario avatar rdelrosario commented on June 14, 2024

Why you want to implement it on mainapplication?

from pushnotificationplugin.

SkillerSKL avatar SkillerSKL commented on June 14, 2024

Because when app is closed, the OnNotificationOpened event not working. What do i do for the event working with app closed?

from pushnotificationplugin.

rdelrosario avatar rdelrosario commented on June 14, 2024

OnNofiticationOpened should work just fine when application closed, did you call ProcessIntent on MainActivity OnCreate method and on OnNewIntent method

from pushnotificationplugin.

SkillerSKL avatar SkillerSKL commented on June 14, 2024

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.

SkillerSKL avatar SkillerSKL commented on June 14, 2024

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.

SkillerSKL avatar SkillerSKL commented on June 14, 2024

Is it right?

from pushnotificationplugin.

rdelrosario avatar rdelrosario commented on June 14, 2024

@SkillerSKL Let me know if this worked for you.

from pushnotificationplugin.

SkillerSKL avatar SkillerSKL commented on June 14, 2024

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.

KGSachinthaU avatar KGSachinthaU commented on June 14, 2024

Hi,
I have same problem,
help me !

from pushnotificationplugin.

simon25608 avatar simon25608 commented on June 14, 2024

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.

rdelrosario avatar rdelrosario commented on June 14, 2024

Try using:

https://www.nuget.org/packages/Plugin.PushNotification/1.2.0-beta

from pushnotificationplugin.

simon25608 avatar simon25608 commented on June 14, 2024

PushNotificationManager does not exist in the current context in MainActivity.
I have de using Plugin.PushNotification;

from pushnotificationplugin.

rdelrosario avatar rdelrosario commented on June 14, 2024

Did you check if Plugin.PushNotification is installed on the Android project references? After the update

from pushnotificationplugin.

simon25608 avatar simon25608 commented on June 14, 2024

Yes, I have the latest version installed on all projects, as you can see in the attached image.

2018-01-18_225301

It's normal when upgrading to the latest version if you uninstall the libraries you see in the other capture?

2018-01-18_224737

from pushnotificationplugin.

rdelrosario avatar rdelrosario commented on June 14, 2024

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.

simon25608 avatar simon25608 commented on June 14, 2024

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.

rdelrosario avatar rdelrosario commented on June 14, 2024

Where are you trying to use this class? It only exists on Android and iOS projects not PCL

from pushnotificationplugin.

simon25608 avatar simon25608 commented on June 14, 2024

I use it only on Android and IOS projects.

Enclosed here is a classes view of the Android project:
img_23012018_164406_0

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.

rdelrosario avatar rdelrosario commented on June 14, 2024

I think this issue is in your environment. If you check the sample this doesn't happen it compiles correctly.

from pushnotificationplugin.

simon25608 avatar simon25608 commented on June 14, 2024

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.

rdelrosario avatar rdelrosario commented on June 14, 2024

Yes I tried the sample on this repo FirebasePushSample and compiles and works fine on Android and iOS.

from pushnotificationplugin.

SkillerSKL avatar SkillerSKL commented on June 14, 2024

OnNotificationOpened not working here yet. @rdelrosario , do you have any sample with this method working with app closed ?

from pushnotificationplugin.

rdelrosario avatar rdelrosario commented on June 14, 2024

The sample FirebasePushSample in the repo, OnNotificationOpened works when app is closed.

from pushnotificationplugin.

simon25608 avatar simon25608 commented on June 14, 2024

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.

rdelrosario avatar rdelrosario commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.