I've built an Android application by android studio.
I want to be associated with users online and notify changes and news.even when my application is closed.
This is what is on my mind,I have web server, i want create a internet connection listener and when connection is available,application or a part of it connect with the server and get new information and notify the user with a notification.even when my application is closed.
How can I implement and enforce it?
Try "Google Cloud Messaging."
Per their Developer Console Help page: "Google Cloud Messaging (GCM) is a free service that helps developers send messages across multiple platforms: Android, iOS, and Chrome. For example, a server can send messages directly to single devices, groups of devices, or devices subscribed to topics. Also, the application on a device can send messages directly to a server and to devices belonging to the same group."
Use the Google Cloud Messaging service alongside the Google Plugin for Eclipse. Google Cloud Platform explains as: "When targeting Android devices, it is easy to get started by using Google Plugin for Eclipse (GPE). GPE allows you to generate an App Engine Connected Android Project that provides the basic logic needed for sending push notifications using Google Cloud Messaging for Android from a mobile backend running on Google App Engine."
This could send messages for you without having to do the work on your own server. If this answer helped you, please consider up-voting or accepting it as the answer. Thanks, and best of luck on your project!
No,These systems are always some limitations and managed with others.I do not need to communicate with iOS or chrome ,I need to design a system that's all for me.Experience has shown me great services, such as Google services and any other company affected by political issues.for example i live in iran right now.
All production-oriented and knowledge-based services for this country is banned.
due to this problems i prefer to have my own messaging and notification system.
Related
I read a lot of articles about how to implement Push Notifications with Cordova (and Ionic 2) and I'm not sure how to implement that in China when not using Google's push server.
I think using https://github.com/phonegap/phonegap-plugin-push is a good idea. But all the Howtos are focussing on creating an account in Google's FCM which is not really helpful in China. I doubt Chinese phones use Google to poll for notifications. Which leads to my next question.
I was assuming that there exists only one central push service for all platforms (Android, iOS and Windows) and vendors for the following reasons:
One platform is only polling from one fixed push server to save battery life.
If an app (server side) is sending a push notification, it does not know anything about the receiver's device, so it can only count on a centralized service delivering the message to the device regardless of platform or vendor.
But do Apple, Google and Microsoft all use the same push service? I doubt it, and that's what makes me confused. Also, if I'm in China, as Google's services are unstable here, the Android phones distributed in China are not using Google and even not install Google Play Store.
When I install a Chinese app (hosted in China) on a German phone (Android) I still get all notifications for that app even if I'm obviously polling from Google's push server. That means, the notification messages of the Chinese app is somehow delivered to Google.
The only explanation for that is that the different push services are working together. Is that the case? If so, than does it make a difference where I create an account (Google FCM: https://medium.com/#ankushaggarwal/gcm-setup-for-android-push-notifications-656cfdd8adbd#.rr2lfivfh), it is still usable on different push servers? Also, when I send a notification, could I use any server all over the world?
How can I find out which push server my phone is connected with (Android)?
A lot of confusing here, I really appreciate if someone could bring light to that topic :-)
The reason GCM / FCM does not work in China is simply because the Great Firewall of China blocks connectivity to all the various Google services, FCM included.
Also, most, if not all, China-sold phones do not come with Google Play Services, a requirement for FCM to work.
Even if you were to take a German phone, as you mentioned, into China, it would not receive notifications albeit having Google Play Services, due to the firewall.
But there are alternative push notification gateways you could use instead, which are far more reliable and do not depend on Google Play Services. One of those is Pushy.
Pushy (https://pushy.me/) offers a highly-reliable push notification gateway for Android apps that works independently from FCM, using its own background MQTT connection. It also offers iOS support so you can push all of your users via a single API for cross-platform support.
Full disclosure: I founded Pushy.
With Cordova, you can use the plugin cordova-plugin-xiaomi-push done with the Xiaomi Android SDK. I have tested and it works well with all the phones when the application is running. And even when the app is closed with Xiaomi phones :)
The advantage to use Xiaomi is that their developer website is in English and their server's APIs are simple.
There are also 2 plugins for Huawei and Oppo, which work well with the respective brand phones, even if the app is closed. But the API side is more complicated than with Xiaomi. To cover all the supplier with notifications when app is closed, it seems necessary to build one version per manufacturer/stores which include the required plugin (That is possible using a bash script) + build a push server that would send the notification to the right provider.
Google FCM notification not works in china country. You have to use some different push notification provider like Pushy.
For China Country, I used pushy service. You can go through this link if you wanna interested to use pushy service. Please check this link.This will help you
I am developing an application that needs to send message from my web browser plugin to my android or IOS app client and get response back on the plugin.
I found XMPP as an option for that but it requires separate jabberID(JID) for each client. But I need to use the same ID lets say users Gmail ID on both the plugin and the mobile application.
Is there any work around so that same Id can be used in the plugin and mobile app or if there is a better way to do this.
You should take a look at Google Cloud Messaging. The underlying protocol is actually XMPP, and it can efficiently push messages between your server (or client!) and Chrome, Android and iOS.
It also comes with powerful features like Device Groups, which let you send a single push message to Google and have it pushed out to numerous devices at once.
For your specific use case, check out the Chrome and Android docs for GCM.
I was just looking at the new Google Cloud Messaging (GCM) and I was wondering if it is possible to use GCM for Instant Messaging on your Android application?
I saw you can send data, like a message, from a server, but is it also possible to send from one device to another one?
And how would this work?
Some example code would be really helpful..
Tnx!
The official docs on Google Cloud Messaging for Android does mention that GCM can be used to develop an instant messaging app.
...or it could be a message containing up to 4kb of payload data (so
apps like instant messaging can consume the message directly).
So we went ahead and created an instant messaging app using GCM. The server-side is powered by Google App Engine. You can read the complete tutorial here. Create an Instant Messaging app using Google Cloud Messaging (GCM)
So it is possible to use GCM for Instant Messaging on Android, to answer your question. However, reliability of GCM compared to XMPP for IM is another topic.
Just my two cents:
I think you should not use GCM for delivering IM. You should have a dedicated server where your Android IM apps will connect to, using a persistent socket connection. Your server will know who is online or not and therefore can present an 'online list' to all the apps.
GCM can come into play, while users are offline or not running your app. A GCM message can be sent to them to indicate 'XXXX wants to chat'. They can then launch your app and automatically connects to a chat session.
Google has said that the delivery of GCM messages are not guaranteed. This reason alone is not a good idea to rely on them for Instant Messaging.
Try pub nub - it is pretty easy to implement - send Im from one mobile to another - simply fire up the web page (see link) in the browser , and chat between pc, mobile - and works - with 'no server'. Code is for javascript but they also have java. Chat app using jquerymobile web app framework
You might want to check out how a server sends a message to the GCM Service. It is possible to use php on Server side so it should be possible to adapt that to a POST request directly out of your application. However, to communicate you need the registered ids of the devices you want to send data to. Means you will need something to store and get them. Best solution would be your own (web) server which stores all ids and handles the Message sending.
I would like to know how the android market initiates the remote download through their website. I'm guessing there is some sort of push notification system. I want to know if it's possible to do the same thing using a different web interface.
The only possibility I see is to use the C2D (Cloud to Device) messaging API provided by Google. In that way you could send an install intent to the device. However that would always open the market locally on the device from which the user can then install the app.
Obviously Google can bypass these "limitations" :)
They use Android Cloud to Device Messaging (C2DM). They allow anyone with a server of their own to implement this service.
From the site:
Android Cloud to Device Messaging (C2DM) is a service that helps developers send data from servers to their applications on Android devices. The service provides a simple, lightweight mechanism that servers can use to tell mobile applications to contact the server directly, to fetch updated application or user data. The C2DM service handles all aspects of queueing of messages and delivery to the target application running on the target device.
How can I send data from a server to an Android device without the device polling for data?
This is called a server side 'push' and is commonly referred to as 'pushing'. This is a well known feature of the iPhone, however, it does not currently exist on the Android. Android Cloud 2 Device messaging has not yet been released to the general development community. you may want to check out projects such as MQTT and Deacon.
You might consider using Googles cloud to device messaging for a solution.
You'll have to sign up for an account and are only able to use AppEngine servers at the moment.
Your application has to use API level 8 (2.2) in order to be able to receive the cloud's pushes.
GCM (Google Cloud Messaging) is the easiest way, and while GCM provides the basic service of sending messages, there are companies out there that do help you get up and running.
You could take a look at companies like urban airship, xtify and mBlox (developer.mblox.com) to get started with this and have a few additional tools that help you structure the push notifications in a more structured way.
Good Luck with your development!