Discussion Forums  >  Self Hosted Control Panels

Replies: 32    Views: 2030

DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
03/26/16 07:48 PM (8 years ago)

Free Push Notification Service -> onesignal.com

Hello folks. Earlier I was trying out a "freemium" push service called PushBots.com. I liked their setup, but some of their more important premium (pay) options are indeed totally free on another service I found: https://onesignal.com One Signal -> I am truly impressed so far. Take note: Installation is easy and fast. They provide a REST API ("restful server" API) that allows your client to use your self-hosted control panel to generate a Push Notification inside a PHP file. This is quite nice because at the moment when your client creates the Push Notification you can have your code to also store their message inside a database, and whenever the app is opened, it can either open a web page that displays that database of messages, or fetch the data and format and display it. Thus you can build a "Push Notification Manager" of sorts. They also have in the API (among the many parameters that can be passed) an option to pass a "URL to open" parameter, and whenever your One Signal-enabled app opens a Push Notification message that passes this URL, the app will open the native browser and point it to the URL. See prior paragraph about a webpage serving up Push Notifications from a database on your self-hosted control panel site! Their API's are nicely documented, allowing useful code examples for a variety of situations, including PHP. For example, this page shows their documentation for using the REST API to generate a new Push Notification: https://documentation.onesignal.com/v2.0/docs/notifications-create-notification They offer code examples on the above page in the following languages/environments: JSON · Shell · PHP · C#(.NET) · Ruby (Rails) · Python · NodeJS · Perl · Parse Cloud · GameSparks · Java The main reasons I'm leaning away from using BT's own Push Notification code are (1) I cannot get the Android code to work for Google Cloud Messaging (GCM) (Google's Push Notification service), and (2) I've been looking for an easy way to get some kind of message "manager" working without having to do months of schooling to learn new languages. I know PHP and databases in PHP, so this helps me. Of course, it is also easy to display in your client's app the above mentioned PHP page (for generating a Push Notification), securing it with a login of course, and allow your client to send their push messages right from the app!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/27/16 07:23 AM (8 years ago)
Duuuuuuuuuuuuuuuude. Sweet! Cheers! -- Smug
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/27/16 10:19 PM (8 years ago)
Follow up: Whenever my PHP page (for the client to generate a Push message with) gets run inside the app's built in 'browser' (as an HTMLdoc), the messages do not arrive, however, if it is run in the native browser, the messages do arrive. I plan to write some login / security code in the PHP page itself, as the URL to it would be visible to the client in the native browser, indeed, accessible to the public if they only know the URL.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/28/16 10:36 AM (8 years ago)
I haven't had time to finish working with buzz touch push. What errors were you getting? Buzztouch uses php as well
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/28/16 10:43 AM (8 years ago)
My situation is that I am using Android Studio instead of Eclipse, and when a Push Notification arrives at the app, it literally kills the app. I tried original code and also tried editing the code according to a post I found here in the forums. The "fix" I found here apparently works in Eclipse but not for me in Studio. It appeared to me to be a mix of "old" style code and "new" style code. I am so new to Android & Studio that I did not even think to try to study the debug output for what was going wrong. I am in hopes that the One Signal approach will integrate and work for Android as nicely as it does for iOS. I am not to that point yet but close to finding out.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/28/16 03:26 PM (8 years ago)
cool. are you using self-hosted or buzztouch.com? Ill take a break from what ive been doing and figure it out real quick wont take long.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/28/16 11:06 PM (8 years ago)
Yes, I am using Self-Hosted. I sure appreciate your help on this!
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/29/16 11:18 AM (8 years ago)
I tried this in my iOS app, I followed this: <a href="https://documentation.onesignal.com/docs/installing-the-onesignal-ios-sdk" target="_blank" rel="nofollow">https://documentation.onesignal.com/docs/installing-the-onesignal-ios-sdk</a> After that my appDelegate.m looks like: //didFinishLaunchingWithOptions... -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ [BT_debugger showIt:self message:[NSString stringWithFormat:@"didFinishLaunchingWithOptions%@", @""]]; self.oneSignal = [[OneSignal alloc] initWithLaunchOptions:launchOptions appId:@"d3662279-e404-4166-b3e9-........my number" handleNotification:nil]; return YES; ------------------------------------- I get no errors, but app doesn't work, only black screen. Am I doing something wrong in appDelegate? Test notification was successfully sent, too. So Push Notifications work fine, but app doesn't.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/29/16 12:44 PM (8 years ago)
Miku: Installing the One Signal code involves several steps listed in their documentation. I will post a link below. However, remember that you should not only add their code, but also remove the BT push code, or use the // "remark" method (or /* "remark" */ method) to prevent the BT code from being executed. Here is the area on their site that shows how to install their SDK for iOS: https://documentation.onesignal.com/docs/installing-the-onesignal-ios-sdk Instructions for installing their SDK for Android are provided elsewhere. That's another can of pretty little worms. :-)
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/29/16 01:13 PM (8 years ago)
Thanks, I followed just what you have in link: https://documentation.onesignal.com/docs/installing-the-onesignal-ios-sdk . Can you tell me how exactly can i remove BT push code and make my app to work?
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/29/16 01:27 PM (8 years ago)
I made some very brief notes for myself. These notes may help you, although it is not a step by step guide, it at least shows you some pages to search through and edit. 1. Edit appDelegate.h and disable all the BT code related to Push Notifications. 2. Edit appDelegate.m and disable all the BT code related to Push Notifications. 3. Search whole project for "promptForPushNotifications" and edit to disable BT code related to Push Notifications. a. Edits will be needed in BT_application.h b. Edits will be needed in BT_application.m c. While in BT_application.m, make sure the hardcode currentMode to "Live" d. Edits will be needed in loadConfigDataViewController.m (And getting the closing */ in the right place is tricky.)
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/29/16 01:31 PM (8 years ago)
I need to mention an important caveat. One Signal's SDK is not supporting below iOS 6.1. Since BT is targeting iOS 5 (my BT apps target 5.1.1) that means there is some concern. I have a support request in right now with One Signal, asking what the downside is. Will my apps work on older devices, but just not get Push? Will Push work, but some features be unavailable? I am looking into this. Also, as always, make a backup copy of your Xcode project, etc, before you start whacking away at code.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/29/16 03:49 PM (8 years ago)
unfortunately i havent been able to setup self hosted since my yearly subscription expired. im subscribed to buzztouch monthly and have new api keys, etc. but still havent got it work. Ill look through the php code to see why I cant make request to the buzztouch api. if you tell me the errors i can walk you through on how to fix them. and/or send me a new created blank "dummy" project and Ill work with that. most people are usually always upgrade to the newest version anyway. so if you do use one signal shouldnt be a problem. even the iphone 4s can go up to version 9. Im sure no one uses a device below that iOS version
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/29/16 09:41 PM (8 years ago)
Thanks! Original iPad is not permitted to update beyond 5.1.1 and we have some users with that device.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/29/16 09:48 PM (8 years ago)
Aw that sucks..no problem anytime
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/29/16 10:28 PM (8 years ago)
Based on the fact that One Signal does not support before 6.1, I am in a place of weighing what happens on devices running iOS earlier than 6.1, compared to trying to get BT code working on Android. Push is super, super important to me, and I need it working on both iOS and Android. More soon!
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/29/16 11:03 PM (8 years ago)
I thought that installation could be "Installation is easy and fast. " as DougJoseph said. But seems very tricky. Would you make brief manuals, it would be very useful, since Parse closes.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/30/16 12:57 AM (8 years ago)
The statement I made about the One Signal implementation is true. One Signal itself has nothing to do with BT. Their install is completely unrelated to removing BT code. Their install is fast and easy. Put another way, the "tricky" part of getting BT push code out of a BT project, is not related to installing One Signal. I never stated that getting BT push removed from a BT project was either fast or easy.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/30/16 01:02 AM (8 years ago)
Just to be clear: I do not work for either One Signal or BuzzTouch. I am just an aspiring developer trying to get something done, and willing to pass along info I think may be of benefit to others. If the info is helpful, be blessed. If not, please don't think either BT or OneSignal are behind my posts or that anyone here has any obligations about it. We're just doing our best. I don't have a detailed step by step guide, but if you look at the brief notes I posted above, and give it a go, you can scan over the code and see what is push related and should be "remarked" out.
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
03/30/16 01:02 AM (8 years ago)
OK, I understand now. Looks that I must stay on Parse PN, at least until it works, and so far it works fine in iOS and Android. Or is there any "lighter", easier PN service for non-programmers?
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/30/16 01:12 AM (8 years ago)
I have a lot of programming history, but since none of was in mobile until just recently, I'm too new to be a guru or even proficient. The whole prospect is daunting enough to make one's head spin. I am having some success on iOS Push Notifications with both One Signal and BT's push code, but One Signal's setup offers a REST API and allows having the notification open the app, and then having the app open a webpage in native browser. That is good and helpful to me. I'm still trying to find out what happens with One Signal code on older iOS devices running iOS lower than 6.1 (i.e. 5.1.1). They don't support lower than 6.1 and all BT projects are currently targeted at 5.x I have been unable to get BT push code working in Android (it kills my app), and so I am hopeful about having success with One Signal push code on Android. There again I would face the task of removing BT push code to let One Signal push code serve instead.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/30/16 03:30 PM (8 years ago)
post the errors from the logcat and ill tell you how to fix it
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
03/30/16 06:50 PM (8 years ago)
Thanks! Trying to get to that point.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
04/02/16 06:19 PM (8 years ago)
figured out i couldnt connect to the buzztouch api from self-hosted because i entered in some wrong info haha. working on a fix now
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
04/03/16 02:21 AM (8 years ago)
OK, thanks.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
04/03/16 01:09 PM (8 years ago)
Ive got as far as registering the app for push on the server. Im not receiving the push though. And the google api console is saying that no requests have been made. Im wondering if generating the token is what they consider a token, because I get a unique token for my device. I think its only the part where the server sends the push to the google server to send to the device. If so probably just the php code needs to be tweaked a little. There is a whole new way google has to send push with gcm but still if it has got this far then it should still work. will update again
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
04/03/16 02:11 PM (8 years ago)
looks like i have something configured wrong
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
04/03/16 05:48 PM (8 years ago)
I figured it out. My configurations were right and the buzztouch php code is fine. Google has a new way of generating the client token on android. So basically I just added the new buzztouch android studio push code to the old self hosted android push code. Then changed to the new way of generating the client token. Ill upload the files to replace along with instructions. Really you just need to change the instances of the my app name to your app name. My app name was "fsdfsf"..lol. So just do a search and replace for that to your app name. Mostly at the top of all 3 or 4 files you will see package:fsdfsf.com . Also there are instances of fsdfsf_appDelegate, that you will need to change. Also the notification is not "tokenized", the message is the payload from google cloud messenger. Ill do that real quick before uploading.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
04/03/16 07:02 PM (8 years ago)
https://www.dropbox.com/s/nqq2gyuck8hw51r/bt_android_push_fix.zip?dl=0 in BT_activity_host.java find the class RegisterForPushAsync and find this line: String gcmProjectNum= "947144077544"; and change it to your google project number. You can also search for cmcoffee because I put a comment above the line.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/03/16 07:09 PM (8 years ago)
If you don't mind I'm going to ride this wave too, and steal a bit of your code, Chris. :) Cheers! -- Smug
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
04/03/16 07:25 PM (8 years ago)
Cool no problem. let me know if anything goes wrong.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
04/03/16 11:30 PM (8 years ago)
THANKS, CMCOFFEE! I am looking forward to trying this as soon as I get a chance!
 
FredLopen
I hate code!
Profile
Posts: 1
Reg: Oct 20, 2017
Vlore
10
like
10/20/17 01:38 PM (7 years ago)
Maybe you must try the ZetPush https://zetpush.com/.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.