google-cloud-messaging

GCM: How to send heartbeat to GCM server

本秂侑毒 提交于 2019-12-12 07:30:04
问题 I want to send a heartbeat from my application to the GCM server, so the connection will stay alive. How can I do that, and how can I know the URL of my GCM server?? Thanks in advance!! 回答1: How to send the heartbeat This class can sent the proper intents public class GcmKeepAlive { protected CountDownTimer timer; protected Context mContext; protected Intent gTalkHeartBeatIntent; protected Intent mcsHeartBeatIntent; public GcmKeepAlive(Context context) { mContext = context;

Implement Firebase inside of a Library

大兔子大兔子 提交于 2019-12-12 07:08:33
问题 I want to implement Friebase notifications system inside a library that I want to use as SDK in many apps. Firebase is asking now for an App ID, but I'm implementing it inside a library thus no App Id. How could I achieve my goal to be able to send notifications to my apps that use my library ? Thanks in advance. 回答1: Yes you can actually do this, on your library build.gradle put this inside the defaultConfig field buildConfigField("String", "FIREBASE_APP_KEY", "\"${firebaseAppKey}\"") Then

GCM doesn't work on samsung tablets

删除回忆录丶 提交于 2019-12-12 06:29:09
问题 I verified that the app can receive notifications on galaxy nexus tablet (4.2)and samsung galaxy s3 phone(4.1.1), but cannot work on samsung galaxy tab 10.1 (4.0.4) and samsung 7 inch tablet(4.0.4) There is more than one google account signed in to the tablet. I received the registration ID, and while I send the notifications I get the error Error log, 05-22 14:40:47.220: W/GTalkService(10357): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm

Android Application get crashed when application is not running or not in system tray and received a GCM notification

梦想与她 提交于 2019-12-12 05:58:40
问题 I am new on Xamarin and android. I am facing issue with my Xamarin Android app. The application is get crashed. when it closed and received a GCM notification from the server. I have applied many configurational changes and update the Manifest. <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name=

Google Play Services need to update in android studio emulator

怎甘沉沦 提交于 2019-12-12 05:29:18
问题 Google Play Services need to update in android studio emulator. But if I press update nothing happens. I am using api 23.1.1. I need to use the op play services to use Google Cloud Messaging . how do you need to update? 回答1: I fixed this issue before by changing a line in my build.gradle file from: compile 'com.google.android.gms:play-services:8.3.0' to: compile 'com.google.android.gms:play-services:7.+' 回答2: Run SDK Manager.exe you will get a pop up of Android SDK Manager. At the bottom u

com.google.android.gms:play-services-gcm:8.4.0 leads to error

谁说我不能喝 提交于 2019-12-12 05:24:30
问题 In my project I was using the following version of GCM library. compile 'com.google.android.gms:play-services-gcm:7.8.0' Now I update it in to the following version compile 'com.google.android.gms:play-services-gcm:8.4.0' But I am getting the following error. 02-05 23:51:29.205 18410-18410/com.example.app E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services

my app doesn't receive any messages from GCM

半世苍凉 提交于 2019-12-12 05:17:49
问题 My app won't receive any messages from gcm I created sender page and receiving class, I want to show it only on notifications bar GCM.php <?php class GSM { function _construct() { } public function send_notification($registration_ids, $message){ include_once './config.php'; $url = 'https://android.googleapis.com/gcm/send'; $fileds = array( 'registration_ids' => $registration_ids, 'message' => $message, ); $headers = array ( 'Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application

How to migrate off Parse to different SENDER_ID

泪湿孤枕 提交于 2019-12-12 05:15:52
问题 We have been using Parse without setting SENDER_ID for sometime now. As Parse shutting down, we need to migrate all the users off Parse. We now have SENDER_ID already setup. How can I send push notification using the existing GCM push token? Is there a way to migrate users tokens to the new account? 回答1: Existing (legacy) GCM tokens generated BEFORE you updated the SENDER_ID can only be published to via the hosted Parse.com solution. Parse.com owns the API Key associated with the default

I have a service gcm in the background, how do I know if the app is open or not?

微笑、不失礼 提交于 2019-12-12 04:50:16
问题 I have a class that extends GCMBaseIntentService, when I get a message from gcm function: @Override protected void onMessage (Context context, Intent intent) { String message = intent.getExtras().GetString("alien"); generateNotification (context, message); } I wish that when a new message arrives the app recognize if the application is open and the user is using, or is a simple background service, and therefore I see a notification. I need to know if it is in the background or foreground, any

Send pending notification after login

扶醉桌前 提交于 2019-12-12 04:36:59
问题 I am using Push notificaiton from androidhive. I am able to run the project succesfully. I have added that in my project. All the things are working perfectly. Now i want to implement that when an user logout from my app he should not receive any message from the server. and after when he logged in again he should see all the pending notifications. I am in a fix , don't know what to do. Here is my logout code: public static void logout(Context context){ // GCMRegistrar.unregister(context);