Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create my own push notification service without fcm , pusher ,

I want to create a notification system provider that is not based on Google services or similar. In fact, I want to get information about its overall architecture and needed Android sdk functionality.

The most weird point for me is to understand how to send a notification to an Android device.

I mean, how can I identify the Android device on which my application is installed from millions and millions of other Android devices on the Internet?

And how do I send information to him? Should I use sockets for this or similar stuff?

like image 603
Mohsen Mirhosseini Avatar asked Jun 14 '18 05:06

Mohsen Mirhosseini


1 Answers

simple answer: YOU CAN NOT

before everything else i should correct your question, pusher and FCM are not in the same group at all! you can build somthing like pusher or oneSignal or etc but you can not build something like FCM/APNS

you should understand three simple yet important sentences below:

  1. when you want to pull anything from place_1(e.g. api) to place_2(e.g. browser_client) you most have an identifier of the place_1_resource (which commonly is the uniform-resource-locator of api)
  2. when you want to push anything from place_1(e.g. notification_central_server) to place_2(cellphone_client) you most have an identifier of the place_2_resource
  3. you must know the differences between a real server push with server-push-like technologies like long-pulling or ... and you should be aware that what is intended in this concept is a real server push not any kind of pulling with a push jacket!

if you don't have any identifier for a cellphone which you want to send it a notification, your server dont know where to send that notification so we need a resource_identifier_like for cellphones which is actually a device_token_like and you have just one approach to get this device_token_like and that is the FCM/APNS

FCM is like a dns server containing all identifiers of every android device that google supports (almost every android device) and APNS is just the same but for apple devices

note1: even if your app can obtain it's corresponding device device_token_like it can not be used for push notification if its not registered on FCM/APNS

so when you get that device_token_like identifier of your desired clinet_device now you can use different approaches for sending sth to that clinet_device. there are several approaches like SSE, Webpush, HTTP_server_push, Pushlet and etc but none of these approaches supported by mother_companies of these devices, the only approach that is completely supported and standard is the same approach that FCM/APNS official websites suggests

for example an iranian Incorporation named najva uses webpush to send notifications because of USA sanctions but webPush method works good on browsers and android devices but they didn't even apear on an apple devices

finally i should say that i admire your curiosity to less using anything from a benefit_based Inc. like FCM/APNS in your developing but i strongly recommend these articles and books for you cause i think you didn't learn enough:

  1. wikipedia of push technology
  2. story of some guy who tries to make his own push notification service
  3. Push Technology A Complete Guide - 2020 Edition
  4. Data Push Apps with HTML5 SSE
like image 61
kia nasirzadeh Avatar answered Sep 27 '22 21:09

kia nasirzadeh