{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-dotNET/issues/37","labels_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-dotNET/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-dotNET/issues/37/comments","events_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-dotNET/issues/37/events","html_url":"https://github.com/ParsePlatform/Parse-SDK-dotNET/issues/37","id":111404524,"number":37,"title":"Do Parse Push Notifications work when app is in background?","user":{"login":"gusennan","id":624632,"avatar_url":"https://avatars.githubusercontent.com/u/624632?v=3","gravatar_id":"","url":"https://api.github.com/users/gusennan","html_url":"https://github.com/gusennan","followers_url":"https://api.github.com/users/gusennan/followers","following_url":"https://api.github.com/users/gusennan/following{/other_user}","gists_url":"https://api.github.com/users/gusennan/gists{/gist_id}","starred_url":"https://api.github.com/users/gusennan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gusennan/subscriptions","organizations_url":"https://api.github.com/users/gusennan/orgs","repos_url":"https://api.github.com/users/gusennan/repos","events_url":"https://api.github.com/users/gusennan/events{/privacy}","received_events_url":"https://api.github.com/users/gusennan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-dotNET/labels/discussion","name":"discussion","color":"eeeeee"}],"state":"open","locked":false,"assignee":{"login":"hallucinogen","id":681920,"avatar_url":"https://avatars.githubusercontent.com/u/681920?v=3","gravatar_id":"","url":"https://api.github.com/users/hallucinogen","html_url":"https://github.com/hallucinogen","followers_url":"https://api.github.com/users/hallucinogen/followers","following_url":"https://api.github.com/users/hallucinogen/following{/other_user}","gists_url":"https://api.github.com/users/hallucinogen/gists{/gist_id}","starred_url":"https://api.github.com/users/hallucinogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hallucinogen/subscriptions","organizations_url":"https://api.github.com/users/hallucinogen/orgs","repos_url":"https://api.github.com/users/hallucinogen/repos","events_url":"https://api.github.com/users/hallucinogen/events{/privacy}","received_events_url":"https://api.github.com/users/hallucinogen/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2015-10-14T14:00:39Z","updated_at":"2015-11-02T18:54:40Z","closed_at":null,"body":"We have been following the Parse for Xamarin Android tutorial as shown in this repository:\r\n\r\nhttps://github.com/ParsePlatform/PushTutorial\r\n\r\nAnd in the parse.com website tutorial.  Push notifications work just fine when the app is open, but as soon as the app is put into the background or is closed no push notifications are registered.  To see if this was a .NET SDK issue or a parse issue, we also went through the Parse Android (plain-java) Tutorial, which worked as expected.  There are some differences between the AndroidManifests in these two implementations, but in both cases we copied line-for-line what was in the Tutorials.  Is this a known issue or is something else needed in order to have pushes be registered with the device while the app is not open?  What I would like to happen is for this to occur, like it does for the vanilla-Android example:\r\n\r\n![desired_outcome](https://cloud.githubusercontent.com/assets/624632/10485803/66efaece-728c-11e5-80b5-1d3558aa69ad.png)\r\n\r\nHere is our Application class and copy of our AndroidManifest.xml\r\n\r\n```cs\r\nusing Android.App;\r\nusing Android.Runtime;\r\nusing Android.OS;\r\nusing Xamarin;\r\nusing System;\r\nusing RebuyApp.Green.Cart.Storage;\r\nusing System.Linq;\r\nusing ReactiveUI;\r\nusing Parse;\r\n\r\nnamespace RebuyApp.Android\r\n{\r\n#if DEBUG\r\n[Application(Debuggable=true)]\r\n#else\r\n[Application(Debuggable=false)]\r\n#endif\r\n\r\n    public class RebuyApplication : Application \r\n    {\r\n        AutoSuspendHelper suspendHelper;\r\n\r\n        public RebuyApplication(IntPtr handle, JniHandleOwnership transfer) :\r\n        base(handle, transfer)\r\n        {\r\n        }\r\n\r\n        public override void OnCreate()\r\n        {\r\n            base.OnCreate();\r\n\r\n            suspendHelper = new AutoSuspendHelper(this);\r\n\r\n            RxApp.SuspensionHost.CreateNewAppState = () => new Bootstrap();\r\n            RxApp.SuspensionHost.SetupDefaultSuspendResume();\r\n\r\n            ParseClient.Initialize(\"OUR-CLIENT-KEY\",\r\n                \"OUR-.NET-KEY\");\r\n            ParsePush.ParsePushNotificationReceived += ParsePush.DefaultParsePushNotificationReceivedHandler;\r\n\r\n        }\r\n    }\r\n}\r\n\r\n```\r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" android:versionName=\"1.5.0\" package=\"de.rebuy.android\" android:versionCode=\"22\">\r\n\t<uses-sdk android:minSdkVersion=\"16\" android:targetSdkVersion=\"22\" />\r\n\t<application android:label=\"@string/app_name\" android:theme=\"@style/RebuyTheme\" android:debuggable=\"true\" android:icon=\"@drawable/launcher_icon\">\r\n\t\t<meta-data android:name=\"com.facebook.sdk.ApplicationId\" android:value=\"\" />\r\n\t\t<service android:name=\"parse.ParsePushService\" />\r\n\t\t<receiver android:name=\"parse.ParsePushBroadcastReceiver\" \r\n\t\tandroid:permission=\"com.google.android.c2dm.permission.SEND\"\r\n\t\tandroid:exported=\"false\">\r\n\t\t\t<intent-filter>\r\n\t\t\t\t<action android:name=\"com.google.android.c2dm.intent.RECEIVE\" />\r\n\t\t\t\t<action android:name=\"com.google.android.c2dm.intent.REGISTRATION\" />\r\n\t\t\t\t<category android:name=\"de.rebuy.android\" />\r\n\t\t\t</intent-filter>\r\n\t\t</receiver>\r\n\t</application>\r\n\t<uses-permission android:name=\"android.permission.INTERNET\" />\r\n\t<uses-permission android:name=\"android.permission.LOCATION_HARDWARE\" />\r\n\t<uses-permission android:name=\"android.permission.CAMERA\" />\r\n\t<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />\r\n\t<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />\r\n\t<uses-permission android:name=\"android.permission.BATTERY_STATS\" />\r\n\t<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />\r\n\t<uses-permission android:name=\"android.permission.READ_LOGS\" />\r\n\t<uses-permission android:name=\"android.permission.BIND_NOTIFICATION_LISTENER_SERVICE\" />\r\n\t<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\r\n\t<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" />\r\n\t<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" />\r\n\t<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\r\n\t<uses-permission android:name=\"android.permission.WAKE_LOCK\" />\r\n\t<uses-permission android:name=\"android.permission.GET_ACCOUNTS\" />\r\n\t<uses-permission android:name=\"com.google.android.c2dm.permission.RECEIVE\" />\r\n\t<permission android:protectionLevel=\"signature\"\r\n    android:name=\"de.rebuy.android.permission.C2D_MESSAGE\"/>\r\n\t<uses-permission android:name=\"de.rebuy.android.permission.C2D_MESSAGE\" />\r\n</manifest>\r\n```"},"comment":{"url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-dotNET/issues/comments/153123639","html_url":"https://github.com/ParsePlatform/Parse-SDK-dotNET/issues/37#issuecomment-153123639","issue_url":"https://api.github.com/repos/ParsePlatform/Parse-SDK-dotNET/issues/37","id":153123639,"user":{"login":"hallucinogen","id":681920,"avatar_url":"https://avatars.githubusercontent.com/u/681920?v=3","gravatar_id":"","url":"https://api.github.com/users/hallucinogen","html_url":"https://github.com/hallucinogen","followers_url":"https://api.github.com/users/hallucinogen/followers","following_url":"https://api.github.com/users/hallucinogen/following{/other_user}","gists_url":"https://api.github.com/users/hallucinogen/gists{/gist_id}","starred_url":"https://api.github.com/users/hallucinogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hallucinogen/subscriptions","organizations_url":"https://api.github.com/users/hallucinogen/orgs","repos_url":"https://api.github.com/users/hallucinogen/repos","events_url":"https://api.github.com/users/hallucinogen/events{/privacy}","received_events_url":"https://api.github.com/users/hallucinogen/received_events","type":"User","site_admin":false},"created_at":"2015-11-02T18:54:40Z","updated_at":"2015-11-02T18:54:40Z","body":"Hi @gusennan, sorry it takes me a while to revisit this. The main issue is here: https://github.com/ParsePlatform/Parse-SDK-dotNET/blob/master/Parse/ParsePushService.cs#L35. When the app is killed/in background it's possible that `ParsePush.parsePushNotificationReceived` is `null` or empty due to the memory of the app being cleared. `ParsePush.parsePushNotificationReceived` is usually being populated inside `Application`: https://github.com/ParsePlatform/Parse-SDK-dotNET/blob/master/Parse.StarterProjects/CSharp/ParseXamarinPushSample/ParseXamarinPushSample/ParseApplication.cs#L26\r\n\r\nThe immediate fix is to fallback to call `DefaultParsePushNotificationReceivedHandler` (https://github.com/ParsePlatform/Parse-SDK-dotNET/blob/master/Parse/ParsePush.Android.cs#L26) when `ParsePush.parsePushNotificationReceived` is `null` or empty. But that's defining a new behavior on its own and might not work as expected. It's definitely better than having nothing to be displayed when push notification is received, but there's no way for external developer to override the behavior in the future.\r\n\r\nAnd that's why I'm still thinking about various way to fix it that would lead to better experience/flexibility in the future. Again, very sorry that it took so long to fix this."}}