I'm working on a responsive website which I will then integrate in an Android webview to build an app. This website is a kind of social network with a built-in notification system.
What I would like to achieve is to be able to send push notifications from the built-in notification system of my website into the right user's phone. I have already built native Android apps and have included some push notification systems... But it was a native app, so I was able to catch the Android device ID to identify the user. In this case, I have a responsive website (into a webview app) where the user logs in / register with HTML, jQuery, PHP languages, not Java. So I'm not able to get the Android device ID.
I had an idea to do that but I'm not sure if it's the best one, so please correct me if I'm wrong :
The user starts my app on his phone
If it's the first time he launches it, we send a request to my
server with the Android device ID + IP address of the user that I store in the DB (in Java language to my server, before starting the webview)
The webview starts
The user creates an account and I check on my website if an entry exists in the DB which matches the user's IP address. If that's the case, I can create a new entry in my DB with the new created user ID and his device ID. Then, it's easy to send him push notifications.
I think it's maybe a little difficult as a solution, but what do you think about it ? Or do you have some suggestions to help me to achieve this ?
Thanks!
Related
Is there any possibility of general notification for an android-based Webview mobile application?
Hi there. I have built an android based WebView mobile application of Nextcloud. [Nextcloud is a suite of client-server software for creating and using file hosting services. It is enterprise-ready with comprehensive support options. Being free and open-source software, anyone is allowed to install and operate it on their own private server devices.] So the activities in nextcloud will be notified with in the website without any issue.
We wan't the notfication to pop-up, like general Android mobile applications. Can any one help me. First i need an clarification is this possible or not?
While using Chrome, The notifications of any websites will be pop-up in our laptop. Like wise we want the webview to pop-up the notifications in mobile.
As far as I know, your requirement is not possible directly. The web push notification only works for the browser. In that browser will be responsible for showing notifications for the user. For example, let us consider we send web push notifications with FCM. Notification will be sent to Chrome/Mozilla server from firebase and it will be delivering it to devices. The browser is responsible for push notification permission handling.
First, webview cannot handle permission.Webview does not have a push server. So it can not receive the notification sent from FCM server.
Alternatively, you can try with service worker api in webview and handle receiving notifications natively. Web push internally uses manifest.json(To configure notification icon,name,fcm id) and service worker API to achieve push notifications for web apps.
Else you can use try Trusted Web Activity(TWA). It uses Chrome custom
tabs to load the webpage. It required Chrome in the device. Since Chrome custom tabs runs on top of chrome, it can handle push notification delivery.
But not sure whether the notification will be delivered via chrome or the app. If your app is a PWA and it uses TWA, a notification might get delivered to your app. Otherwise, it might get delivered through the Chrome browser
I am developing an android application and i need to send a notification from the app to a phone number (another device).
Can anyone tell me how can i implement this? any methods or API i can use?
Thank you in advance
I don't think you can do it without developing server-side software that Android devices will connect to. In your server-side software you can use FCM(Firebase Cloud Messaging) or any other framework/library to send notifications to one or group of devices.
Problem is that you need to have connection to the other device and you can't know if that device is connected to internet and even if it is you don't know the address of that device. 99.99% that you need server-side software.
the easiest way (but the most expensive i guess) is to have the first device send a request to a server (whose backend you have to build, eg. php) that will send a push notification to the second device via Google Cloud messaging service.
that's not so easy because the second device to receive the notification must register at GCM and the first device must identificate the id of this device (the common way is to have a common id like username)
There is on possibility without using server side code, Send SMS to the second Phone and read the SMS in second phone and display your notification in second phone. It will cost the SMS charges in both phones.
Create an API that communicates with the users of the application this will be able to send updates to the registered users at real-time.
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
I'm building a simple motivational quote app that generates a random quote from a MySQL database. The app works fine on mobile and I want to sync the quote message to a Wear device. I'm using MessageApi to do so and used this tutorial to set it up: http://android-wear-docs.readthedocs.org/en/latest/sync.html.
However, the message functionality only works when the app is running on the host device. I need to launch the app on Wear alone and still be able to receive the message from the mobile device. I thought of running the same application on the Wear device where it will run an httpconnection on it's own but from what I understand this is not possible with Android Wear.
So my question is, is there a way to open an app on a Wear device that will trigger the mobile app to open in the background and hence receive the message that way?
Your mobile app can implement WearableListenerService. In that service implementation, you can listen to messages that are sent to your phone from your companion app on a wear device (when such message is sent to your phone, the framework on your phone starts up your service and passes the message to it). You can then implement the logic you need in that service (fetch a quote, etc) and respond back to your wear's message; when its work is done, that service will go away on its own. For this to work, your wear app needs to send such message to your phone app upon start up (or whenever you see appropriate in your app). This approach should work and probably is the most appropriate approach for your use case.
I am developing a game app where I am using Facebook SDK login button to retrieve the friend list. I want to send an invite to challenge their peers on the app. So the app receives a request from someone that they want to be challenged.
I do not want to use the request Dialog that uses facebook notifications. I want my own app to receive the notification and notify the user for incoming challenge.
I did some research and I could use the NSD but unfortunately it only allows you to connect to people on the same network. I want to be able to connect to friends from far away. I heard you can use emails but I have not found any documentation.
If you can point me to the right direction I really appreciate it.
ok i suggest the below approach for what you are trying to achieve, use facebook sdk to get the user friend data, there will be an id and name in the response. you can use this facebook id to give people a unique id in your system. when people are wanting to challenge their friends you use their id from facebook friendlist and lookup in your system if these friends have registered/ install your application. if so you send a notification to them if not may be you suggest them to send them a email or sms with a uri to ask them to install the application. Try the Graph API Explorer to play around with the data you can get from the Graph API.
We developed a Hotel Menu Order project in android. Now We have created the project successfully. We are using java, Jax-rs for web service, Mysql for database and Rest for communication.
Now we want to add some more features in our app. When the customer conforms their order that order should show to kitchen and admin. When we google for some example we found one way. That is Google Cloud Messaging. But this is online sevice. We can not use this service.
Because we are using in offline services. We use one centralized server in the hotel and all the devices will connect with WiFi. There is no internet connection.
In this case how to notify the user a row is updated in Database. Please let us know how to achieve this.
Via SMS, what you can do is that you can send the sms to the devices using thrid party services like twilio, on client side i.e. device end you can get the sms broadcast validate the number and the sms content, read the content and update the application DB and the UI accordingly.
Or if one device has internet then what you can do is send GCM notification to that device, and from that device you can update the other devices through wifi direct. But wifi direct has some limitation, I think using SMS is a better option.
u can use Google Cloud Messenger services, by which google provide free message service to your client. http://hmkcode.com/android-google-cloud-messaging-tutorial/ this example will help u to understand better.