Push Notification for iOS device - java

Can anyone help me in details how to send push notification for iOS device while I am using Java for server side program and I am using Google App Engine.
Thanks.

First you must have access to Sockets Java API, which requires you to enable billing.
Second, use the java-apns library. It needs some modifications to run on AppEngine.

Related

How to send push-notifications from java-server?

I have apps on Android & iOS, & I need to send push-notifications to them from Java-server.
Please tell me, where can I find guides how to do this? I'm looking GCM & APN for Android.
https://firebase.google.com/
That is what I use for project and I am satisfied with it.
You have all needed tutorials and docs to start working with it.
Overview:
firebase provides You with Admin SDK wich helps You build Data and Notification messages and send it to firebase, firebase then sends it to either iOS or Android if You send it to specific client or to both if You send it to some created topic.
It also have easy to use Android, iOS, JavaScript libs to handle it on client-side.
ofc to get this work with Your server Client must generate notification token from provided google api and send it to Your server to store in DB.
there are some restriction though with push notifications 2kb if I remember correctly and 4kb for data messages keep it in mind when you create your communication architecture :)

Send message from Android mobile app to Azure IoT Hub

For an IoT project, we need to send messages from mobile application (iOS and Android) to Azure IoT Hub. We were able to do it connecting as a device using MQTT library. However, the device simulator too connect as a device and since both uses same device ID, the existing connection is dropped when both connect to IoT Hub at the same time.
We realized we need to connect mobile apps as a service (not as a device) and for that some research shows we need to use following library.
https://github.com/Azure/azure-iot-sdk-java
https://github.com/Azure/azure-iot-sdk-java/blob/master/service/iot-service-samples/service-client-sample/src/main/java/samples/com/microsoft/azure/sdk/iot/ServiceClientSample.java
However, this java sample uses lot of java specific implementations and which are not supported by Android.
Has anyone faced the same problem?
Which library can we use to achieve above from Android mobile application?
Which library can we use to achieve above from iOS mobile application?
Please let me know if any alternate solution is available.
You can use a REST API for sending a D2C message to the Azure IoT Hub. The following screen snippet shows an example of this call. Note, that no library is required for this request.
another solution for your scenario is to use an Azure Function as a pre-processor to the Azure IoT Hub, see the following example:
Thanks
Roman
Just as additional content about another solution for your scenario. Based on my understanding and per my experience, I think you can try to create an App service, such as Mobile App for using Custom API at the side of client & backend, or WebApps, etc, to receive the payload which includes custom json properties from your Android App, and forward the payload message using Azure IoTHub SDK for NodeJS or Java to IoTHub.

How to implement push notifications on my android device

I have a very basic design of my entire application, where several users with my app on there android devices commits data to the server (I have used REST web services(java) + postgresql as my server) through HTTP post request from the android application. I am successful in achieving this and app runs absolutely fine. Now i want to implement a scenario where any change(CRUD operations) on my db on server should create a notification on my users android device. How should i achieve this with my server design unchanged? I have looked into Google Cloud Messaging, but could figure out the server implementation.
For now i have implemented db triggers on postgresql and able to get control back into java code using Notify/Listen feature of postgresql. From here i need to connect to android device. How can this be achieved. Is Google Cloud Messaging the only way? I have not seen any insert/update statements in there server implementation. Could anyone please guide me on this?
either you can use GCM or implement a Socket at server end and open a socket connection from mobile but this approach may add some additional processing overhead because it will create a daemon thread to listen socket port from mobile device.
You should use native library (NotificationManager etc.), here you can find a great tutorial.
My Advice is for you to use GCM. GCM normally takes a maximum of 4kb, so you could have your own defined "commands". You could use them to determine the requests on both ends, ie on android app and the server end. A php script on the server would help you in this.
I am working on an app where by the android app sends messages to the server via POST and the server forwards the message to the appropriate user via GCM. In my case I have very many things to share so in that case I am using commands, for example if it is a new incoming message I send a GCM to the app with one variable as the command and the rest as the data. On the android app I use the command variable to determine what to do with the data.
Kindly avoid that socket advice, it will have your app drain the battery to sustain the open socket , besides you don't have to re-invent the wheel while Google servers already has it

Send data to android app from web client

I'm trying to make it such that a click on my web client from a computer can "trigger" the android app to run its set function.
I've searched extensively but it seems like all methods need the mobile device to initiate a connection before the web server can even do anything.
Is there a way for the web client to be the one initiating? Also, is there any way to do this without notifying the user of the device, i.e. in the background? I'm using cakephp for the web client but any kind of answer will be appreciated. Thanks!
Use push notification system to trigger any action on your device. Push notification system such as Parse, PushApps, pubnup etc are available for free and some are paid too. Try them. Send a push notification and listen to that push message and on receiving trigger your action.
Use Google Cloud Messaging .
"Google Cloud Messaging for Android (GCM) is a service that allows you to send data from your server to your users' Android-powered device, and also to receive messages from devices on the same connection. The GCM service handles all aspects of queueing of messages and delivery to the target Android application running on the target device. GCM is completely free no matter how big your messaging needs are, and there are no quotas."[Google]
Here you'll find how to implement the GCM with PHP.

How does the c2dm application push to the Android app?

I am new in Android and trying to develop an app with push notification. I have a small confusion on the architecture behind the c2dm, that after getting the authentication token and device reg_Id, the application server will send them along with the message, but how will the server will know to send the message to the c2dm server?
I am getting an error and even I am not able to add a google account on my emulator for synchronization. While doing this my emulator says com.android.calender not there.
Thanks in advance.
you have to call web service to sent push notification on particular device. And whatever the massage you want to pass on device is written in web service. you can make web service any any language like php or .net. Ask me if you have any query regarding push.

Categories