Question

Is it possible to test push notification in mobile apps, such as android & ios, with an emulator rather than a physical device?

In this ( http://docs.telerik.com/platform/appbuilder/sample-apps/sample-backend-services-pushnotifications ) article, I learned that such testing was not possible from within the emulator. During a quick Google search, I noticed many other push-notification services couldn't be tested in the emulator.

I would like to be able to be able to test the push-notification feature without needing to posses a physical device, because I can't afford them.

Was it helpful?

Solution

iOS

You cannot test real push notifications on iOS Simulator because it does not support it. You would get this error if you tried to register for remote notifications:

NSCocoaErrorDomain Code=3010 "Remote notifications are not supported in the simulator"

You should try to debug the app on real device not on the simulator. However you can mock push notifications on iOS using this library.

Android

The Android emulator is capable of receiving push notifications through GCM, however, it does require an additional step of actually logging a valid Google account into the emulator when it is running. This will need to be done for each emulator that you wish to use with push notifications through GCM.

OTHER TIPS

Just in case anyone runs across this post (it was a top hit for me searching for similar information) looking to do this in a more modern (than 2014) Xcode environment: YES, it is possible to do this in iOS simulator now! This page has a great tutorial on how to do so.

Quick summary: create a JSON-formatted text file containing the payload, such as

{
  "Simulator Target Bundle" : "com.example.app",
  "aps" : {
    "alert" : {
        "title" : "push title",
        "body" : "push body"
    }
  },
  "isRead" : false,
  "createdOn" : "2021-12-01T20:14:50.3157643+00:00",
}

then drag and drop that file onto the simulator!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top