6.0 KB

The fuck is this

This shit is a dankass receiver app for push notifications from (eventually) multiple sources. [=[=[==[[=[

You can (de)register per service whenever you want. The corresponding device UUID will also be displayed and can be copied just by tapping on it (you might need to longpress). ;]

Supported push services

Currently it only works with OneSignal, which in turn connects to platforms such as Firebase Cloud Messaging (FCM) for Android and Apple Push Notification Service (APNS) for iOS to actually distribute the notifications to devices. I prefer using OneSignal instead of connecting to FCM and APNS meinself, since you'll have 1 dashboard where you can see all users at once instead of having to log into every one separately. =]

As of writing this shit, OneSignal is free for:

  • 30k web push subscribers (sent to a browser, like Whatsapp Web does)
  • Unlimited mobile subscribers

Which is p gucci. ;]

Also, if you deregister, all it actually does is unsubscribe you. Meaning your device will still be listed in the dashboard but it won't be able to receive notifications.

Setting up that shit

Alright, so this is necessary to make sure your device(s) won't end up in my OneSignal account, but rather your own.

  • Obviously, install the app first (but don't do anything inside it yet)
  • Go to the OneSignal website
  • Sign up and create an app, prolly just wanna name it Pushem as well ;]
  • It will guide you through setting up your first platform connection, so use the Google Android (FCM) platform and set up the Firebase connection by following OneSignal's directions
  • After that it will ask what SDK you're using, choose Server API (at the bottom y0) because at least the Android one requires you to check for a subscriber at the end
  • When that's done you need to configure an application somewhere to use the app ID and/or REST API key (depending on application): in the OneSignal dashboard while viewing the Pushem app, go to Settings > Keys & IDs to see that inf0rmation
  • Go into the settings of the Pushem app on y0 phone and update only the App ID with the corresponding value from above, keep the settings screen open/active until later
  • Now create a "notification channel" for Android within the OneSignal dashboard (Messaging tab), this helps down the road when more push services are added
  • First, create a group and name it something like OneSignal (we'll be using one group per pr0vidur ;])
  • Go back to the Android app and update the Notification channel group name with the name you just entered (it's not case-sensitive but otherwise it needs to match eggzactly)
  • Add a category within that group (prolly best named after the sending application, e.g. temp_sensor) and set some defaults, these settings can later be changed within Android through the regular Settings app > Apps > Pushem > App notifications (or something similar, prolly differs per device/vendor lol)
  • After you've saved the category, reopen its settings, look for the Channel ID on the bottom right and again slam that in the config of the sending application (if necessary/available 0bv m8)
  • Now close the settings in the Android app and register your device with OneSignal
  • Wait a couple of seconds and in your OneSignal dashboard go to Audience > All Users, where you should see your device
  • You should now be able to receive push notifications (e.g. my temp_sensor shit makes an API call to OneSignal, which relays it to mein ph0ne through FCM, gg ez)

Muy importante:

  • The notification channel group name must be set before receiving even 1 (U N O) notification. OneSignal uses a group-less category called Restored for already received but not dismissed notifications. Pushem tries to move it to the group you created above to keep everything from 1 provider together. If you fail to set the group before receiving notifications, it will be unchangeable and it will remain under Other. The only """fix""" is to uninstall the app so Android will clear these notification channels, then reinstall and do it right. ;] I could have Pushem delete and recreate the channel, but if multiple providers create an ungrouped category with the same name, shit gets funky. ;] So I won't bother.
  • If you change an app ID in the settings of Pushem, it will attempt to deregister from the old one and prompt you to restart the app, since many SDKs don't really expect that shit to change on the fly. It also won't automatically reregister with the new app ID after reopening the app, there are many reasons why you would want to hold off on that for a bit. I doubt people would change it often anyways but might as well letchu kno. ;];]];;]];];];
  • You may have noticed you can also set up segments, which is entirely optional but might help telling receivers apart. I'm using a segment named temp_sensor to make sure that it only sends me shit.


Shit should be p self-explanatory imo tbh. ;]

Releasing modified (and signed) APKs

You'll need to make some adjustments if you want to release signed APKs lol. Refer to the section right here (only applies to Mac OS X, if you're on Windows then idk how to do something similar :>).

Hurrrr pls halp it's br0ke

Simply change the build variant in your Andr0id IDE to debug, then it'll have OneSignal using debug mode too and you can see all the requests it's doing (and the responses it receives).

Alternatively, if your problem is that notifications don't arrive, check deez nuts docs from OneSignal:

So far I haven't yet had this problem though. =]]]]