FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
05/01/15 12:50 AM (8 years ago)

Android and push

Can i have some advice guys, while ive been using push a while on ios, setting it up is easy. Ive been trying to set up on android for over week, with no joy, do i need to use a 3rd party service to use android push, ive tried following the info found on here and stack overflow, but i cant seam to find the project number, ive set it up right with the api and cloud messaging with the api, but all i get is project id and project name, no project number, I am using self hosting and still in eclipse, any advice would be good, from someone who has managed to get it working, cheers guys Sean
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/01/15 01:52 AM (8 years ago)
I wrote this guide back in the day (when bt hosted push came out), but I haven't looked at it in a while. https://www.buzztouch.com/files/howtos/HowToAndroidPushWithGCMForBuzzTouchPush.pdf
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/01/15 02:01 AM (8 years ago)
Followed this couple times dude, but the problem i get is my google developer console only gives me project id and project name, not project number as your guide suggests,what i get is this https://www.dropbox.com/s/gv6ff5oa33vdqsw/console.png?dl=0
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
05/01/15 02:52 AM (8 years ago)
Few months ago I tried Android push too, but none of solutions worked. Then I tried also with Parse, never worked too (but iOS works). Cmcoffee checked Android Parse and found that it works fine on Android Studio. Now I wait that Android Studio will work on self-hosted and then I will try this Parse push again.
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/01/15 04:45 AM (8 years ago)
cheers guys, guess i will just wait till self hosted go,s studio and try again. Sean
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/01/15 06:58 AM (8 years ago)
I did have it working under test conditions, but I never used push in a production app and it's been a long time. I am sure the instructions were correct at the time of writing and others have had success with them. SI know Google Play services interface has changed, this was written for the old console, which is available still. Are you sure or you didn't miss a step? Also, who says that Android Studio does not work with self hosted?
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/01/15 08:08 AM (8 years ago)
parse works fine for self hosted and the new androd studio project.it just needs tweaking on the current self hosted. You have the old developer console ha that's weird.try this link https://console.developers.google.com
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/01/15 08:56 AM (8 years ago)
Thanks guys, i know its something im missing, i did try the new google console , but still couldn't get the project no, will take look at parse now, is self hosted set up for studio, meaning the output project, I thought we where waiting on an update from David for self hosted, cheers guys Sean
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/01/15 10:22 AM (8 years ago)
It's named something different I think.I'll post back when I look back at it
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/01/15 10:30 AM (8 years ago)
click on "overview" then it shows the project number
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/01/15 10:43 AM (8 years ago)
ahh there it is, so can i set up push with that and the gcm no, or do i still need 3rd party ie parse cheers AL Sean
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/01/15 10:48 AM (8 years ago)
Yes, and parse also uses gcm but they have their own project numbers so you don't have to g through that step
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/01/15 10:51 AM (8 years ago)
so i have to set up parse first then google console :) or other way round
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
05/01/15 11:08 AM (8 years ago)
This is my discussion about Parse: https://www.buzztouch.com/forum/thread.php?tid=EDB98F6DAD4588E06FF318C It the end you can find: "Parse works flawlessly on new bt android studio package", but studio package is not available for self-hosted. I think David works on that. Or an I missing something?
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/01/15 05:17 PM (8 years ago)
@funkymonkey, if yu use parse ,you don't need to set up Google console, parse does that for you.you just add their code to your project.they do have the option where you can use your own Google console keys though if you want @miku The instructions I made for parse are for the self hosted before David even released the android studio project. that's why it's extra steps .you don't need to follow my little guide if you choose to use the android studio package that's on the buzztouch.Com apps, you would just follow parses instructions. I recently added parse to a self hosted app and I think it was even eadier.parse constantly improves the sdk
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/01/15 11:19 PM (8 years ago)
cheers dude, thanks for your advice, will get on parse today Sean
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/01/15 11:54 PM (8 years ago)
its asking me to add something to the build gradle, thats studio isnt it, im using eclipse,
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
05/02/15 12:50 AM (8 years ago)
@CMCOFEE "I recently added parse to a self hosted app and I think it was even eadier.parse constantly improves the sdk". Can you tell me how, if David didn't make self hosted Android Studio package yet?
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/02/15 08:57 AM (8 years ago)
Funkymonkey,If you're using eclipse don't follow their instructions.follow the instructions I posted.its the post dragon007 started.at work on break so not able to find link now.a quick search will do. @miku.I imported the eclipse project into studio and followed he same instructions I posted on dragon007 post.I think you tried it before.you dnt have to import it into android studio because the instructions I made were using eclipse.everything's better when you use android studio though
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/03/15 04:46 AM (8 years ago)
Hi guys, right after day and half of trying to get parse to play with eclipse, its not happening, followed all the advice on here and still ended up with app that crashes on launch (this app is on both ios and android, working great prior) I cant use studio yet and i know parse works well with studio, as im self hosted and thats not ready for studio yet, so i reverted back to al,s guide above, and it seams all i needed was the project no, which i knew i needed to start with, but couldnt find it in the google (old console) opened the new console and someone pointed where the Number i needed was, I now have app that connects to the push part in my self hosting, the device is asking if i can recieve push from app, but im not getting any messages on the device, no errors no warnings and nothing in the logcat, im using a live acer tablet as device, where am i going wrong Al Cheers Sean
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/03/15 05:13 AM (8 years ago)
Hi Sean If I remember correctly, one thing that caught me is you need to have your app using live BTconfig.txt if your app is set up with a live key, otherwise use the developer BT config.txt. I had it working when testing, but, I never used BT push on a live app. I have seen other posts about android push and devices not registering correctly. I don't remember if there was a solution, it seems to work for some people but not everyone. Worth a bit of a forum search. Btw, I believe you can compile your self hosted android apps on Android Studio today. There may be one or two plug ins that don't play nicely, but I can't say for sure as I have not made the switch myself yet. Alan
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/03/15 06:16 AM (8 years ago)
Cheers Al, Ive just put new binary into play to see if it affects live devices, will test live btconfig as well, its all registering with my console and everthing, message go,s out fine, will keep tinkering just glad i got it to register with my console, cheers dude Sean
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/03/15 06:22 AM (8 years ago)
Fingers crossed!
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/03/15 07:21 AM (8 years ago)
No joy, changed it to the live version, i think its something to do with the difference in settings in the new google console, hopefully someone will do how do for the new google console, as im nearly there with yours dude, theres just something im missing, Cheers Sean
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/03/15 07:27 AM (8 years ago)
You app usually crashes like that if you entered the code in the wrong place. What did the LogCat say?
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/03/15 08:16 AM (8 years ago)
Ive deleted the parse stuff on it, in order to follow als guide, im trying to launch the app in studio now dude, will let you know how i do, the push side is very important so the easy it is the better, supposedly the studio and parse work great,
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/03/15 09:34 AM (8 years ago)
You would still need to look at the LogCat to see why it's crashing with bt push.also on self hosted it crashes when a push is sent.ictguy posted a fix awhile back.also it doesn't show long messages.before ylusing parse,I just copied and pasted the btgcmconfig.java and btgcmintentservice class from the new android studio package to the same classes in the self hosted package.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/03/15 09:36 AM (8 years ago)
You really just have to copy the notification code but I just went ahead and reused those files
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/04/15 03:24 AM (8 years ago)
My app is set up with studio no errors, but the app is crashing after accepting push notifications, but not when refusing push, both bt panel and parse are recognizing the device and sending push with no errors, any pointers would be great guys. cheers Sean logcat shows, when crashing 05-04 11:25:21.772 17463-17463/com.thecarltonhotel E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.thecarltonhotel, PID: 17463 java.lang.ExceptionInInitializerError at com.thecarltonhotel.BT_activity_host.registerForPush(BT_activity_host.java:749) at com.thecarltonhotel.BT_activity_host$4.onClick(BT_activity_host.java:712) at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5061) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:603) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String at com.thecarltonhotel.BT_gcmConfig.getGCMProjectNumber(BT_gcmConfig.java:69) at com.thecarltonhotel.BT_gcmConfig.<clinit>(BT_gcmConfig.java:47)             at com.thecarltonhotel.BT_activity_host.registerForPush(BT_activity_host.java:749)             at com.thecarltonhotel.BT_activity_host$4.onClick(BT_activity_host.java:712)             at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)             at android.os.Handler.dispatchMessage(Handler.java:102)             at android.os.Looper.loop(Looper.java:149)             at android.app.ActivityThread.main(ActivityThread.java:5061)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:515)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:603)             at dalvik.system.NativeStart.main(Native Method)
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/04/15 03:34 AM (8 years ago)
oh and this, dont get how i fix this BT_activity_host:device is NOT registered with GCM (Google Cloud Messaging)
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/04/15 05:11 AM (8 years ago)
What's on line 749 in bt activity host java file? also a fix: http://www.buzztouch.com/forum/thread.php?tid=56643342D49BA08BDEEB1EF
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/04/15 06:15 AM (8 years ago)
line 749 GCMRegistrar.register(this, BT_gcmConfig.SENDER_ID); im following the other link dude, now my app opens, dus not ask for push and then crashes bit later ive redun the whole project in studio, while the above fix,s the crash, still not receiving push
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
05/04/15 07:56 AM (8 years ago)
Got it working guys, after following above, it was server key you needed for api, now while this worked and sent message through my device from self hosted, i replaced the key for android maps in manifest with the new server key, but wont this effect maps within the device, anyway after help from guys above, I followed this guide http://www.buzztouch.com/forum/thread.php?tid=56643342D49BA08BDEEB1EF (follow the 2nd comment and emend as in 9th comment) used server key as detailed below To create the new server key, follow the steps, Go to <a href="https://cloud.google.com/console/project" target="_blank" rel="nofollow">https://cloud.google.com/console/project</a> Click your Project Go to APIs & auth on Left Panel Select Credentials in submenu on Left Panel Under Public API access, click on "Create New Key" Choose 'Server' On next dialog, Specify the whitelisted IPs, if you have any. Leaving it blank, the requests will be from any IP Click Create. You will find the new server key is created under "Public API Access" and i managed to send push to the android app through my self hosted control panel, managed to package project and insert in play while using android studio, i will update when my app is live and i do fresh install on diff devices, Thanks for all your help guys, couldn't do it without you Cheers Sean
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
05/04/15 11:08 AM (8 years ago)
You use the api key I believe for the maps
 

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.