Every company that deals withwebsite developmentand applications, have their own lists of favorite clients and projects. We love our customers, especially those who, in addition to the finished product at the end, want to independently understand the technologies and rise to the level of a specialist. Any methods are used, but "torture with questions" is especially popular (any tester is resting).
Why aren't push notifications coming? - image
We collect them, analyze them and find answers - and we decided to share the results with you.
Technical portrait of the application being developed
We were busycreating a mobile applicationfor a clothing store, whose architecture was built on the basic Activity (fragments are used to display information). The Retrofit library was used to load data from the server, and the built-in dependent SQLite database was used to store it. Loaders were chosen to execute requests to the server and to select from the database.
To make the application interactive and allow chinese student contact list exchanging messages, we connected push notifications. In this case, VK and Facebook SDK are used to implement authorization/registration via social networks and it looks like this: when a user sends a message, he sends a request with this message to our server. It forms a request with a message and data about the user to whom the message was addressed, and sends all the information to the Google server. It forms a push notification from this request and sends it to the user's device. Our application receives this push, parses (processes) it and displays it in the chat - communication is implemented.
Why don't I receive push notifications? - 2 - image
There is a problem: when does the application start working in the background or why do push notifications come only after launch?
A client approached us with this question because he had experienced the following dilemma: when launched from a second device, the application works well, but how does the “autoload” work then?
We explain. The application starts working in the background immediately after installation, and subscription to push notifications is carried out after registration in the application.
If the user does not register in it, then push notifications will not work for him.
Why don't I receive push notifications? - 3 - image
There are other possible explanations that are worth considering:
Push notifications work via the GCM (Google Cloud Messaging) service, so if there are no Google Play Services on the device, their operation is unstable, or the manufacturer has made its own improvements to their operation, then push notifications will not work completely or there will be interruptions in their operation. If there are no Google Play services on the phone, you will not even be able to register for push notifications. Of course, you can do this “forcefully”: if after registration the subscription to push notifications on the server failed, then you need to continue trying each time you log in to the application until a successful result. The reason for this situation may be problems with the operation of Google Play services - in this case, the attempt to subscribe may end in nothing.
Why aren't I receiving push notifications?
-
- Posts: 14
- Joined: Wed Dec 04, 2024 4:25 am