google-cloud-messaging

Android - Receive Push notification and display it - not quite understanding

扶醉桌前 提交于 2019-12-22 09:47:30
问题 Ok so I finally got setup to register devices for push notifications. I found this code to receive new notifications and display it. Thing is I'm not sure where it goes. I'm pretty new to Android programming so any help is appreciated. I have a service class called GCMService below. import android.content.Context; import android.content.Intent; import android.util.Log; import com.google.android.gcm.GCMBaseIntentService; public class GCMService extends GCMBaseIntentService { private static

Send firebase cloud message from client without exposing API secret

六眼飞鱼酱① 提交于 2019-12-22 09:37:36
问题 I'm developing a new chat application that currently works with firebase realtime database and cordova. I was looking for a backend-less solution since my currently working app doesn't need any server at all apart from a tiny server that its only function is to provide with temporal authorization tokens for the clients. This tokens allow the client to work directly with firebase without the need for a more expensive and loaded server, and still have a central control for the usage of the app.

Android Notification: add typeface for title and content

﹥>﹥吖頭↗ 提交于 2019-12-22 08:57:42
问题 I'm trying to add a Typeface in my NotificationCompat.Builder -> setContentTitle() and setContentText() . I initialized Typeface by Typeface banglaFont = Typeface.createFromAsset(this.getAssets(), "kalpurush.ttf"); in IntentService . To create Notification i used following code. NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this) .setLargeIcon(bitmap) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(userName) .setAutoCancel(true) // .setStyle( // new

GCM push notification with android [closed]

六眼飞鱼酱① 提交于 2019-12-22 08:39:10
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Recently, I've tried to learn GCM and make a test application that will get the push notification for android through androids official site. However, I find the tutorial difficult for me. Are there any simple and easy tutorial for a novice like me to learn GCM push notification without the use of a server for

Google Cloud Messaging, returning 401 Unauthorized

夙愿已清 提交于 2019-12-22 08:32:50
问题 I followed the example on https://developer.android.com/google/gcm/notifications.html#gen-client trying to create notification key from client. getAccounts() method did return a valid google account. GoogleAuthUtil.getToken(context, accountname, scope) also returns a valid scope string. However the response from the post on https://android.googleapis.com/gcm/googlenotification is 401, and is an html page: <HTML> <HEAD> <TITLE>Unauthorized</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"

GCM token refresh and when to send the token to server

只谈情不闲聊 提交于 2019-12-22 08:17:20
问题 I am following a GCM-Android integration example from the official guide. In particular I am confused about the following lines in the above linked class: // You should store a boolean that indicates whether the generated token has been // sent to your server. If the boolean is false, send the token to your server, // otherwise your server should have already received the token. Now I call the intent service each time my main activity launches and I believe that instanceID is responsible for

How do i know if my GCM Message is small enough (< 4kb) to send? (How to get size of String?)

a 夏天 提交于 2019-12-22 07:12:46
问题 I want to embed data directly inside of a GCM (Google Cloud Message) in order to help my application skip a round trip to my server. Google says the total data payload needs to fit inside 4kb. Data is sent using [key,value] pairs. Assuming I did something like this: String key = "key"; String data = "data"; Message message = new Message.Builder().addData(key, data).build(); sender.send(message, regId, 5); How can I know if the String data is less than 4kb? To my knowledge there's no way to

Leaked IntentReceiver error when calling GCMRegistrar.register()

a 夏天 提交于 2019-12-22 06:37:39
问题 I'm trying to finish the getting started steps on Google's GCM from Google's Android Developer site. When my device tries to register, it fails with the following reason: Activity has leaked IntentReceiver from com.google.android.gcm.GCMBroadcastReceiver that was originally registered here. Are you missing a call to unregisterReceiver? This is the code: GCMRegistrar.checkDevice(this); GCMRegistrar.checkManifest(this); final String regId = GCMRegistrar.getRegistrationId(this); if (regId.equals

Registration ID duplication for GCM

ぐ巨炮叔叔 提交于 2019-12-22 05:24:24
问题 We have an app that uses GCM. When user firstly opens the app,app checks the shared preferences to look whether user is registered previously.if not the registration id is taken from GCM and stored to shared preferences. There is also a 3rd party server where user id and registration ids are stored. I read and implemented the following cases for canonical id issues: During sending notification,if a new registration id (canonical id) is received, the old registration id is updated with the

specify valid wake lock level

老子叫甜甜 提交于 2019-12-22 05:22:07
问题 working an an app with GCM support, no problems there. But when I push the notification, the app crashes an LogCat says the following: 03-21 14:32:13.276: E/AndroidRuntime(4457): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.yanniks.cm_updatechecker/de.yanniks.cm_updatechecker.UpdateChecker}: java.lang.IllegalArgumentException: Must specify a valid wake lock level. How do I define the valid wake lock level? Please help! 回答1: You must specify one of PARTIAL_WAKE_LOCK