PushBot Android client not working - android

I followed the instruction but when I test sending the message I do not receive anything.
There are no errors in the application and the pushbot console sees that that there is a registered device.
How can I find out what is going on ?
The Code is very template like and follows all instructions that they have provided.
The application
import com.pushbots.push.Pushbots;
import android.app.Application;
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
String SENDER_ID = "ID here";
String PUSHBOTS_APPLICATION_ID = "Pushbot App Id";
Pushbots.init(this, SENDER_ID,PUSHBOTS_APPLICATION_ID);
}
}
The manifest looks like the following
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.zuppush"
android:versionCode="1"
android:versionName="1.0" >
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<permission android:name="com.example.zuppush.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.zuppush.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:name="com.example.zuppush.MyApplication"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.zuppush.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.example.zuppush.MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.pushbots.push.PBMsg"/>
<activity android:name="com.pushbots.push.PBListener"/>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.zuppush" />
</intent-filter>
</receiver>
<receiver android:name="com.pushbots.push.MsgReceiver" />
<service android:name="com.pushbots.push.GCMIntentService" />
<service android:name="org.openudid.OpenUDID_service" >
<intent-filter>
<action android:name="org.openudid.GETUDID" />
</intent-filter>
</service>
</application>
</manifest>

I'm not sure which version of com.google.android.gcm.GCMBroadcastReceiver you are using, but if it's the default implementation taken from the old client GCM library, this implementation expects the GCMIntentService to be in the main package of your app (com.example.zuppush), which is not the case.

I just signed up for pushbots recently. No technical support. No one is answering the phone. Their phone number forwards to a business that has nothing to do with pushbots. Please be aware, I don't think this company exists anymore. I lost my 1st month subscription to the service, without any service actually being delivered. I assume that pushbots service is no longer available, and that no one is still using the service, despite the fact that they are still accepting credit cards on their web site. Sketchy.

Related

Unable to receive Pushy push notifications on Android

I am using Pushy to send push notifications to an app running on Android device.
Received the PN and got this message on Android studio console.
D/Pushy: Received push for package com.abc.def
However, the broadcast receiver configured in AndroidManifest.xml is not getting called. I followed the steps exactly as in the Pushy documentation below.
https://pushy.me/docs/android/modify-androidmanifest
Tried to debug the android.app.ContextImpl code but got lost.
What am I missing?
EDIT#1
Posting AndroidManifest.xml as requested.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.def" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="28" />
<!-- Pushy Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- End Pushy Permissions -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!-- Pushy Declarations -->
<!-- Pushy Notification Receiver -->
<!-- Incoming push notifications will invoke the following BroadcastReceiver -->
<receiver android:name=".PushReceiver" android:exported="false">
<intent-filter>
<!-- Do not modify this -->
<action android:name="pushy.me" />
</intent-filter>
</receiver>
<!-- Pushy Update Receiver -->
<!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
<receiver android:name="me.pushy.sdk.receivers.PushyUpdateReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<!-- Pushy Boot Receiver -->
<!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
<receiver android:name="me.pushy.sdk.receivers.PushyBootReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<!-- Pushy Socket Service -->
<!-- Do not modify - internal socket service -->
<service android:name="me.pushy.sdk.services.PushySocketService"/>
<!-- End Pushy Declarations -->
<activity
android:name="com.abc.def.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The broadcast receiver:
I had set a breakpoint in the onReceive method. Could that cause any issues?
package com.abc.def;
import android.content.Intent;
import android.content.Context;
import android.content.BroadcastReceiver;
public class PushReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent)
{
//TODO
}
}
Found that I had blocked some important thread & so could not receive the notification.
Removed the wait on the thread and am now getting notifications.

GCM messages are not received with android app at all

I have an old problem: I cannot receive GCM messages with android app. According to the server log they are succesfully delivered to the GCM server and are sent further, but my client side app doesn't seem to have received them.
This is the GCM-relevant fragment of my manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<permission
android:name="my.package.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="my.package.permission.C2D_MESSAGE" />
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.GCM_RECEIVED_ACTION" />
<category android:name="my.package" />
</intent-filter>
</receiver>
<service android:name=".GcmIntentService" />
This is my service-class GcmIntentService:
public class GcmIntentService extends GcmListenerService {
private String TAG = "myReceiver";
#Override
public void onMessageReceived(String from, Bundle data) {
Log.d(TAG, "message received");//this log is never shown
if (!data.isEmpty()) {
Log.d(TAG, "interesting message receiver");
}
}
}
This is my project build.gradle dependency:
classpath 'com.google.gms:google-services:1.3.0-beta1'
I think I forgot to add something, that's why it doesn't work at all. I tried with WLAN and SIM-card internet. so the promblem is not in internet firewall. Sender API and GCM-token seem to be correct (they were copied and pasted from the corresponding settings of the developer account).
Thank you for your help in advance.
Edit: see the answer below
Do following changes in manifest
Replace following code
<service android:name=".GcmIntentService" />
with
<service
android:name="packagename.MyGcmListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
and in
<uses-permission android:name="your.package.name.permission.C2D_MESSAGE" />
write whatever youer packagename is in place of
"your.package.name"
A few things are wrong / might be wrong. You need the sender id in the gcm registration code of the main activity.And you have 3 times the C2D_MESSAGE permission, which is the first time wrong (put.your.package.name). The second time it is correct for the production stage but will not work for development, and the third time you have the permission correct for development.
You should only have it once.
And indeed like #Android india suggests change your service declaration in the manifest.
Please see this
your receiver declaration has some bug
<receiver
android:name="yourpackage.receiver.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="yourpackage" />
</intent-filter>
</receiver>
Android Manifest fragment that works:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- This app has permission to register and receive data message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<permission
android:name="my.package.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="my.package.permission.C2D_MESSAGE" />
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="my.package" />
</intent-filter>
</receiver>
<service
android:name="my.package.GcmListener"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
</application>

Distriqt ANE key cannot be verified in Android

I am developing an App for iOS and Android, for this app I am using ANEs from distriqt, and they say they work for both platforms. In iOS these ANEs work but when I develop in Android I get the error: Your key was not able to be verified for the com.distriqt.Notifications native extension, but the key works for NetworkInfo ANE.
If you have had a similar situation with these ANEs, could you please help me to attack this problem?
Thank you very much.
PD: My descriptor for android where i declare the extensions is below.
<extensions>
<extensionID>com.milkmangames.extensions.GoViral</extensionID>
<extensionID>com.distriqt.NetworkInfo</extensionID>
<extensionID>com.distriqt.InAppBilling</extensionID>
<extensionID>com.distriqt.Application</extensionID>
<extensionID>com.distriqt.Notifications</extensionID>
<extensionID>com.distriqt.PushNotifications</extensionID>
<extensionID>com.distriqt.Core</extensionID>
</extensions>
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto" >
<!--<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>-->
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Only this application can receive the messages and registration result -->
<permission android:name="com.4starscasino.4StarsCasino.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.4starscasino.4StarsCasino.permission.C2D_MESSAGE" />
<uses-permission android:name="com.android.vending.BILLING" />
<application>
<receiver android:name="com.distriqt.extension.notifications.NotificationsReceiver">
<intent-filter>
<action android:name="com.4starscasino.4StarsCasino.NOTIFICATION" />
<action android:name="com.4starscasino.4StarsCasino.DELAYED_NOTIFICATION" />
</intent-filter>
</receiver>
<receiver android:enabled="true" android:exported="true" android:name="com.distriqt.extension.pushnotifications.PushNotificationsBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.4starscasino.4StarsCasino" />
</intent-filter>
</receiver>
<service android:enabled="true" android:exported="true" android:name="com.distriqt.extension.pushnotifications.gcm.GCMIntentService" />
<receiver android:name="com.distriqt.extension.pushnotifications.PushNotificationsReceiver">
<intent-filter>
<action android:name="com.4starscasino.4StarsCasino.PUSHNOTIFICATION_SELECTED" />
<data android:scheme="dtpn" />
</intent-filter>
</receiver>
<receiver android:enabled="true" android:name="com.distriqt.extension.application.receivers.ApplicationStartupReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity android:launchMode="standard">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.LoginActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="Login" />
<!-- replace 000000000000000 with your numeric Facebook Application ID -->
<provider android:authorities="com.facebook.app.NativeAppCallContentProvider634656129942853" android:name="com.facebook.NativeAppCallContentProvider" />
<!-- replace 000000000000000 with your numeric Facebook Application ID, and com.yourcompany.example with your apks application ID -->
<meta-data android:name="com.4starscasino.4StarsCasino" android:value="634656129942853"/>
<activity android:name="com.distriqt.extension.inappbilling.activities.PurchaseActivity" android:theme="#android:style/Theme.Translucent.NoTitleBar"></activity>
</application>
</manifest>
]]></manifestAdditions>
<!-- Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit before namespace 3.0, 32bit after -->
<!--<colorDepth></colorDepth>-->
<!-- Indicates if the app contains video or not. Necessary for ordering of video planes with graphics plane, especially in Jellybean - if you app does video this must be set to true - valid values are true or false -->
<!-- <containsVideo></containsVideo> -->
</android>
The issue will be with your application id, as it's not a valid Java package name, AIR will convert it to a valid one when creating the application apk. However this will cause issues with your manifest additions and key validation.
Basically starting a package name with a number or using hyphens are not valid in Java. You should either change your application id to something like:
com.fourstarscasino.fourStarsCasino
Or else you'll have to determine the actual Android package name and use that instead. It probably is something like:
com.A4starscasino.A4StarsCasino
You should unzip the apk and check the AndroidManifest.xml for the actual Android package name.

how to add ringtone or vibrate notifications for post and messages in android scringo social networking app?

i am using SCRINGO SDK in my android app....following are the screenshot for my app.. it is working fine but i am not getting notification when someone post , like or comment an activity , user messages .. i want to setup up alert ringtone or vibrate notification for that app so even when any user who is registered to the app got notifications on home screen with vibrate or alert tone (like ... user 4 likes your post.. you have a new message from user 2)...
i have tried using gcm services but its not working ... i have produced the app on google cloud got the project number and api key added it in scringo's dashboard.. and edited the mainfest but m not getting the desired result.... following is my mainfest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="com.scringo.friendz" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<permission android:name="com.scringo.friendz.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="com.scringo.friendz.permission.C2D_MESSAGE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<permission android:name="com.scringo.friendz.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.scringo.friendz.permission.MAPS_RECEIVE"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<receiver android:name="com.scringo.push.ScringoGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.scringo.friendz"/>
</intent-filter>
</receiver>
<service android:name="com.scringo.push.ScringoGCMIntentService"/>
<activity
android:label="#string/app_name"
android:name="com.scringo.friendz.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.scringo.push.ScringoGCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter >
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.scringo.scringosample" />
</intent-filter>
</receiver>
<receiver android:name="com.scringo.friendz.MyReceiver">
<intent-filter>
<action android:name="com.scringo.LoginBroadcast" />
</intent-filter>
</receiver>
<service android:name="com.scringo.push.ScringoGCMIntentService" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBx8aj7JrKh-rQAD96FgeAlf8-XFLc4ELc"/>
<activity
android:label="#string/title_activity_image_view"
android:name="com.scringo.friendz.ImageViewActivity" >
</activity>
</application>
</manifest>
Is it possible that you designated an IP address when setting up your server key (the instructions say to leave it blank, thus allowing all IPs)?
I followed the instructions provided by Scringo here exactly as written, and after successfully sending a test push message I started getting new message alerts when another user messaged me.

Specific device not receiving Google Cloud Messaging notifications

I have an application where I'm implementing Google Cloud Messaging notifications, but in a specific device the messages don't arrive. This device has the minimum requirements to use GCM (Android version 2.2, Play Store installed and an Google Account logged). In the log I see that the device is receiving the registration id and sending to the back-office where I have a list of devices registered.
My question is: Do I need to make extra configurations to make the device receive these notifications?
Here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="br.com.testegcm"
android:versionCode="1"
android:versionName="1" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.example.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />
<application
android:name="TesteGCM"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<receiver
android:name="br.com.testegcm.GcmBroadcastReceiver"
android:exported="true"
android:enabled="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="br.com.testegcm" />
</intent-filter>
</receiver>
<service android:name="br.com.testegcm.GcmIntentService" />
<activity
android:name="br.com.testegcm.Home"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:theme="#style/notitle" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Change this :
<permission android:name="com.example.gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" />
to :
<permission android:name="br.com.testegcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="br.com.testegcm.permission.C2D_MESSAGE" />
Add the same issue and i eventually i realized that i need to change in the manifest, the broadcast receiver package name from com.example.gcm to my package name :
<!-- Push notifcations-->
<receiver
android:name=".BroadcastRecivers.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.example.gcm"/>
</intent-filter>
</receiver>
To
<!-- Push notifcations-->
<receiver
android:name=".BroadcastRecivers.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="MY PACKAGE NAME"/>
</intent-filter>
</receiver>
No apart from Android version 2.2, Play Store app installed and an Google Account logged in no other configuration is needed, Now there are only two cases left
1) Either there is some ambiguity in your code.
2) or may be it is a device specific issue.
I had the very same problem.My code would work on nexus4(Kitkat) but would fail to get me a notification from the appln server(via gcm server).For versions less that 4.0.4 you should make sure that you have your google account setup on your device for gcm to work. I had google account on my phone but the mistake I made was that my Account and Sync settings in my galaxy ace was 'Off'.When I turned it ON and ran my code, i received the notification.
Please check the following solution. if still didn't work, let me know.
Add RECEIVE and REGISTRATION Intent in two different intent filters
<receiver
android:name=“<.GCM BroadcastReceiver Name>“ // Name of your BroadcastReceiver, define in code.
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name=“<Package Name>" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name=“<Package Name>" />
</intent-filter>
</receiver>
<service android:name=“<.GCM IntentService Name>" /> // Name of your IntentService, define in code.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Add RECEIVE and REGISTRATION Intent in two different intent filters as shown as above otherwise it won’t work for some devices(Ex. HTC).

Categories

Resources