Title: Push style notification on Android Post by: Chris Fieldhouse on November 06, 2017, 06:37:17 PM Hi
I was wondering, is it possible to create a push style notification from a Win32 server to an Android app? I have a need to inform individual Android clients when a server event has happened, if it were a WebApp I would look at WebSockets, but as this is an Android App, I wondered if you had a component that I had missed, or is it possible to use WebSockets from within the Android app? Many thanks Chris Title: Re: Push style notification on Android Post by: D.Tkalcec (RTC) on November 06, 2017, 06:56:09 PM You can use WebSockets on all supported platforms (Win32, Win64, MacOSX, iOS32, iOS64 and Android).
Best Regards, Danijel Tkalcec Title: Re: Push style notification on Android Post by: HelgeLange on November 06, 2017, 08:06:22 PM I used TRtcHttpClient and TRtcDataRequest and it works like a charm. The HttpClient you set to fcm.googleapis.com and you can call it like :
Code: procedure TDMRTC_GF.SendMobileNotification(const ADestino, AMessage: String); Title: Re: Push style notification on Android Post by: Chris Fieldhouse on November 07, 2017, 11:00:10 AM @Danijel
Thanks for the info. I don't suppose you can provide a code snippet for how I might initiate the WebSocket client in the Android App? @HelgeLange Thanks for the code sample, unfortunately I cannot use Google push as this has to be done on a LAN without using external services. Many thanks Chris Title: Re: Push style notification on Android Post by: D.Tkalcec (RTC) on November 07, 2017, 11:27:21 AM You can find WebSocket Examples in the "Examples\WebSockClient" and "Examples\WebSockServer" folder (Client and Server) in the RTC SDK package. Even though these Projects use the VCL, because of which they only compile for Windows (since VCL is Windows-only), all RTC components and RTC-specific code used in these Projects should work with all platforms supported by the RTC SDK (Android, iOS, Mac OSX and Windows) when used from a FireMonkey Project.
Best Regards, Danijel Tkalcec Title: Re: Push style notification on Android Post by: D.Tkalcec (RTC) on November 07, 2017, 12:16:45 PM Actually, the Client-side Example for WebSockets is also available as a FireMonkey Project (just checked), but ... since there were a number of changes in FireMonkey between Delphi versions, you will probably need Delphi 10 or later if you wanted to compile it as-is. RTC components and all RTC-specific code should compile with VCL and all FireMonkey versions, though (as already mentioned in my previous reply).
Best Regards, Danijel Tkalcec Title: Re: Push style notification on Android Post by: HelgeLange on November 07, 2017, 03:40:18 PM @HelgeLange Thanks for the code sample, unfortunately I cannot use Google push as this has to be done on a LAN without using external services. Wouldn't App Tethering work just nice ? |