google-cloud-messaging

How do i keep different configurations for my android app with GCM 3.0

感情迁移 提交于 2019-12-18 11:55:41
问题 I want to keep different configurations for my debug/release build variants but apparently, the google-services.json file only allows for one. Is there any alternative? Is there a way to keep several files? 回答1: I'm using this workaround to solve a similar issue with build flavours. The flavour specific google-service.json files are stored under /app/src/{flavour-name}/google-service.json . To copy this to the /app dir the following code may be added to the /app/build.gradle file: gradle

How to parse GCM respond to remove invalid registration id from server with php

梦想与她 提交于 2019-12-18 11:55:09
问题 I got a question about Google Cloud Messaging... I send GCM to Google for 3 Registration IDs, then Google replies that 2 of the Registration IDs has been sent successfully and one not, because the Registration ID was wrong! But it doesn't tell me which Registration ID has not been sent... Now here's my question: how can I parse the Google GCM response to get that which Registration ID has not been sent? Does Google has an API or something so that I can give it "multicat_id" and it tells me

Android push notification: Get data, store and display on new activity on click of notification

折月煮酒 提交于 2019-12-18 10:57:26
问题 I am developing an application which is having push notification functionality. I followed the following link as Android Push Notification I tried and successfully send URL and open the web page on click of notification by doing the following change in code of generateNotification(). /** * Issues a notification to inform the user that server has sent a message. */ private static void generateNotification(Context context, String message) { NotificationManager notificationManager =

GCM couldnt receive message

心已入冬 提交于 2019-12-18 09:53:30
问题 Server: var GCM = require('gcm').GCM; var apiKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var gcm = new GCM(apiKey); var message = { registration_id: 'APA91bEAjoFkJu6KF-UgbLWhB-qbHs6fHeYANpB1XFT4Y8NQbjaOJPQ_PItvBpPF5Zi3thEB6H-_0SXkT7JcYB4yGMOa-jZyeygkxTzy56bbqG8zqLSGouFpSr4F5uGvHzEywH_E3Lko8W57XiCe8F_NJGSvkA0i1jAvXkVvCYTzEyar-OAec10', // required collapse_key: 'Collapse key', 'data.key1': 'value1', 'data.key2': 'value2' }; gcm.send(message, function(err, messageId){ if (err) { console.log("Something

Is a GCM registration token with a colon valid?

守給你的承諾、 提交于 2019-12-18 09:13:27
问题 i am using the below code to get the DCM Registration token String token = "NoREG"; try { InstanceID instanceID = InstanceID.getInstance(getApplicationContext()); token = instanceID.getToken("xxxxxxxxxxxxxx", GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); Log.i(TAG, "GCM Registration Token: " + token); } catch (Exception e) { Log.d(TAG, "Failed to complete token", e); } i am getting the registration token in an unusual format like dsYKKXPzztU:APA91bH2J5OqK9OHEp7p5RUJ46fO

GCM Implementation using PHP always facing Unauthorized Error 401

微笑、不失礼 提交于 2019-12-18 08:56:43
问题 I am always getting 401 error.Please any one could let me know exactly what should be HTTP referrers if i am using my local server. i.e Currently I am using: http://localhost/GCM/index.php and generating a API access key using it. Here is my php code for GCM request. $key='mykey'; $headers=array('Contenttype:application/json','Authorization:key='.$key); $url = 'https://android.googleapis.com/gcm/send'; $ch = curl_init(); $curlConfig = array( CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT

Laravel + Google Cloud Messaging (Connection timed out)

那年仲夏 提交于 2019-12-18 07:14:20
问题 I am using Laravel as Backend server for my android application. Here is the package I used for sending push messages: https://packagist.org/packages/davibennun/laravel-push-notification I made all settings (server-side + client-side) and gave it a try. It sends messages without any issue, except sometime it gives me a timeout error: Zend \ Http \ Client \ Adapter \ Exception \ RuntimeException Unable to connect to android.googleapis.com:443 . Error #0: stream_socket_client(): unable to

How long does it take for a message from Google Cloud Messaging to arrive on device

倾然丶 夕夏残阳落幕 提交于 2019-12-18 06:12:25
问题 How long does it take for a message from Google Cloud Messaging to arrive on a device? I want to link my door bell with my Android App. The door bell I receive on a RaspberryPi which has an internet connection. I could connect to Google Cloud Messaging, but would the message arrive soon on my Android device? 回答1: Almost immediately (1-2sec) if phone is active and has stable internet connection. But there is no 100% guarantee. If phone is sleeping it can take time. If you forgot to pay your

GCM registering with two different working registration ids

时光总嘲笑我的痴心妄想 提交于 2019-12-18 05:52:51
问题 I'm having a slight issue with device registration management on my client/server for push notifications. Problem The problem that I'm having is that when I uninstall the application and re install it the application returns an empty string for the registration id ( GCMRegistrar.getRegistrationId(this) ) which I re-register the device with my server. The problem is that I get a new, different registration id (sometimes) and BOTH WORK! So I don't know how server side to know whether it's for

GCM registering with two different working registration ids

六眼飞鱼酱① 提交于 2019-12-18 05:52:27
问题 I'm having a slight issue with device registration management on my client/server for push notifications. Problem The problem that I'm having is that when I uninstall the application and re install it the application returns an empty string for the registration id ( GCMRegistrar.getRegistrationId(this) ) which I re-register the device with my server. The problem is that I get a new, different registration id (sometimes) and BOTH WORK! So I don't know how server side to know whether it's for