Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 7    Views: 65

CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
04/05/16 06:24 PM (3 years ago)

Avoid getting your apps blocked by Google May 17th

This is for securely posting with ssl using httpsurlconnection instead of the apache libraries.
I was running into problems using apache libraries posting to my server. This is the new way anyway.


Many will have this warning in this post:
http://www.buzztouch.com/forum/thread.php?tid=BF50F4B61C83A1EE3A12B77

or simply cant connect because the client (your android device) cant recognize certificate with host, etc.

I found a fix.

I found it from here:
http://stackoverflow.com/questions/23798402/how-to-send-post-data-to-https-server-via-httpsurlconnection

https://www.dropbox.com/s/1b9mzu537qcaq4w/androidPostSnippet.txt?dl=0
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
04/05/16 09:53 PM (3 years ago)
Thank you so much!
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
04/06/16 06:41 PM (3 years ago)
your welcome, anytime
 
mysps
Code is Art
Profile
Posts: 2076
Reg: May 14, 2011
Palma
33,260
like
04/07/16 01:32 PM (3 years ago)
Thanks!
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
04/08/16 10:46 AM (3 years ago)
Almost missed this, thanks!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/28/16 09:33 PM (2 years ago)
How does this work for us, Chris? Do we use it 'in place' ?

Do we augment existing code, replace existing code?

I'm not sure 'where' I should put this... does it go in 'one' plugin, or all that use https?

I see the fix... just not sure 'how' to implement it.

Cheers!

-- Smug

PS: before all my moaning drowns out my thanks, thank you!!
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
06/23/16 07:47 PM (2 years ago)
Sorry I just saw your post Smug. Im writing this fix now. Theres three different places in the new android studio package of buzztouch . But only the part that posts to the server for push notifications is in use so you can really just comment out the other two.

The other two places that will need to be updated for use is in BT_downloader.java and BT_imageLoader.java. The last two methods in both of the methods. These are the two methods that arent in use.

In ServerAsyncTask in BT_gcmServerUtils.java is where it needs to be changed. NameValuePair is deprecated but you can just put the parameters in a string like I did in the dropbox code. Im going to check if I can use some other object similar to nameValuePair.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
06/23/16 07:48 PM (2 years ago)
Ok did a quick 'google' and found we can use another class instead. Looks pretty similar. Will make the code cleaner too. Ill post my full solution soon though.

http://stackoverflow.com/questions/29378012/namevaluepair-deprecated-for-openconnection
 

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.