Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 10    Views: 171

AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
04/11/16 01:22 AM (8 years ago)

BT3 Push Notifications guide for OneSignal, Android & iOS

I recently succeeded in adding OneSignal push notifications to one of my BT 3 apps, after @ictguy and @DougJoseph posted that they had it working. One of the attractions of OneSignal (apart from being free) is that you can import Parse apps into theOneSignal console, which I haven't tried (yet). There are a few of us using Parse.com, who have announced their plans to stop providing their service. I found the guides from OneSignal to be very good. For Android I still use Eclipse, they have Android Studio guides too. I'm not a great coder and I often find when adding 3rd party features like this, that there is a lot of experimenting, head scratching and trial end error. If I don’t make notes, down the road I forget how I did it. So, referencing OneSignal instructions wherever I could, I made a couple of howto docs, making Buzztouch specific notes along the way. I know others who were successful mentioned they removed / commented out a lot of code; I didn’t, so I thought I'd post my recipes, there is an iOS howto here: http://bit.ly/1TJPvho and an Android howto here: http://bit.ly/1Vfa8Ui. Enjoy!
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
04/11/16 01:31 AM (8 years ago)
Many thanks for this. Just to be sure, for Android you use OneSignal and for iOS you use PushWizard, correct?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
04/11/16 01:44 AM (8 years ago)
Oops. The OneSignal iOS link is http://bit.ly/1Sa4AcS I did get pushwizard working too, but for iOS - I haven't been as successful on PushWizard with Android.
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
04/11/16 04:25 AM (8 years ago)
Thanks. Very helpful.
 
KozmoWeb
Aspiring developer
Profile
Posts: 342
Reg: Dec 08, 2012
Sarasota, FL
8,520
like
04/12/16 12:56 PM (8 years ago)
Thanks! I'll check it out! William
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/14/16 09:03 PM (8 years ago)
@Alanmac Thanks for putting that together! I used Android Studio and the integration of the SDK was pretty painless .... just add some lines to your build.gradle file and it works out how to build with the latest SDK - sweet!! manifestPlaceholders = [manifestApplicationId: "${applicationId}", onesignal_app_id: "your-app-id-7298364698-made-up-numbers", onesignal_google_project_number: "1221-more-made-up-numbers"] Cheers Darrel
 
Worker73
Android Fan
Profile
Posts: 419
Reg: Feb 06, 2012
Austria, Klagen...
4,490
like
04/21/16 11:50 PM (8 years ago)
Hi ictguy... Im trying to use "OneSignal" also... But when i send an Message on my Phone there are 2 Messages.. On is Okay and One is JSON Code.... Must i disable something Buzztouch related? Iam on NON Self Hosted and Android Studio (Newest Release)... Thanks for Help..
 
ictguy
Aspiring developer
Profile
Posts: 564
Reg: Jun 17, 2011
Mildura, Austra...
15,840
like
04/22/16 03:07 PM (8 years ago)
Hi @Worker73, I wonder if there are two methods still in the code that present the final message - one would be onesignal and one would be BT? I had to comment out a lot of the BT google cloud messaging code in the BT_activity_host.java file. I think @AlanMac got it working without doing this??? But he was using eclipse (not that should matter). Cheers Darrel
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
04/23/16 01:42 AM (8 years ago)
Hi @Worker73, sounds like you got the onesignal bit to work. Darrel's right, I found all the onesignal additions just went in smoothly and didn't clash with any existing BT code. I didn't remove any of the existing java to get this running. I did have to comment out a couple of lines in the android manifest (which I documented), which prevented the BT push from working in parallel, I'm wondering if you have done that (or not). I think what you are seeing is BT push trying to process the notification (showing the json) as well as onesignal (showing correctly).
 
Worker73
Android Fan
Profile
Posts: 419
Reg: Feb 06, 2012
Austria, Klagen...
4,490
like
04/23/16 02:46 AM (8 years ago)
So, i just commented out two lines in the AndroidManifest and now there comes only the OneSignal Message.... works Fine von Emulator and Connected Android Smartphone... But on Compile (Signet APK) i got an DEX Problem, see here: https://dl.dropboxusercontent.com/u/20632136/OneSignal.png I think the Problem is the GCM "double" Call, but where to Delete the Buzztouch Code ;-)
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
07/13/16 12:32 AM (8 years ago)
OneSignal works for me fine on iOS, but in Android Studio I got error: Error:The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html, where it says: android { compileSdkVersion 21 buildToolsVersion "21.1.0" defaultConfig { ... minSdkVersion 14 targetSdkVersion 21 ... // Enabling multidex support. multiDexEnabled true } ... } dependencies { compile 'com.android.support:multidex:1.0.0' } -------------------- This is what I did, but I don't know what exactly to do with this: In your manifest add the MultiDexApplication class from the multidex support library to the application element. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.multidex.myapplication"> <application ... android:name="android.support.multidex.MultiDexApplication"> ... </application> </manifest> -------------------- How should look this part of manifest if my package name is: com.testXY ?
 

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.