I am trying to add push notification from the parse.com service which has its android sdk and following settings to cocos2d-JS project
Add parse sdk to lib ( I added it to runtime-src/proj.android/lib) and added as build path
Call Parse.initialize from the onCreate method of your Application class to set your application id and client key:
public void onCreate() {
Parse.initialize(this, "app_key", "client_key");
}
For this , I created a package name of com.mycompany.myapp in runtime-src/proj.android/src/
Now android manifest where I have to following things
<?xml version="1.0" encoding="UTF-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="1" android:versionName="1.0" package="com.mycompany.myapp">
<uses-sdk android:minSdkVersion="9"/>
<uses-feature android:glEsVersion="0x00020000"/>
<application android:name="MyApplication" android:debuggable="false" android:icon="#drawable/icon" android:label="#string/app_name">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name" android:value="cocos2djs"/>
<activity android:configChanges="orientation" android:label="#string/app_name" android:name="org.cocos2dx.javascript.AppActivity" android:screenOrientation="portrait" android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode"
android:hardwareAccelerated="false" >
</activity>
<!-- Flurry permissions and settings -->
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!-- parse.com Requires this -->
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
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" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="com.mycompany.myapp" />
</intent-filter>
</receiver>
<!-- End of the receivers for Push Notifications -->
</application>
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Required for Android Id -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Required for InApp -->
<uses-permission android:name="com.android.vending.BILLING" />
<!-- Parse push notifications permisison -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
android:name="com.mycompany.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.mycompany.myapp.permission.C2D_MESSAGE" />
<!-- end of permission for parse push notif -->
</manifest>
But still this app is not getting registered for notification , I am trying to use parse.com push service with cocos2d-JS native project anyone where am I going wrong?
Related
I am having trouble getting Push Notifications to work in my Unity application on Android. I have followed the steps in the Parse documentation, including setting up the AndroidManifest.xml. The device registers an installation, which I can see on the dashboard. However, when using the dashboard to create a Push the delivery report always says "PPNS - OUTDATED DEVICE" for my tablet.
I followed the instructions for creating the AndroidManifest.xml file from here:
https://www.parse.com/apps/quickstart#parse_push/unity/android/existing
Do I need to set the "GCMSenderId" value of the installation? The documentation was kind of ambiguous on that.
Here are the contents of my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.unity3d.player.permission.C2D_MESSAGE" />
<uses-permission android:name="com.unity3d.player.permission.C2D_MESSAGE" />
<application
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:debuggable="true"> <!-- SET TO FALSE FOR RELEASE BUILD -->
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.parse.ParsePushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
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.unity3d.player" />
</intent-filter>
</receiver>
</application>
</manifest>
OK, so I've figured it out. I had a few things wrong with the manifest file, but the most important thing was changing the package name from the default of "com.unity3d.player". I had another test Unity app on the device using the same default package name, and I believe that because it was installed first it was intercepting the notifications.
Anyway, here is my AndroidManifest.xml file for anyone else having trouble with Parse Push using Unity3D and Android devices.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.yourproductname"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.yourcompany.yourproductname.permission.C2D_MESSAGE" />
<uses-permission android:name="com.yourcompany.yourproductname.permission.C2D_MESSAGE" />
<application
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:debuggable="true"> <!-- SET TO FALSE FOR RELEASE BUILD -->
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.parse.ParsePushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
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.yourcompany.yourproductname" />
</intent-filter>
</receiver>
</application>
</manifest>
Note that you would replace all instances of "com.yourcompany.yourproductname" with whatever package name you want to use.
Well, i register an app in Parse, when i test my app, the app send my installation information but the GCMSenderIr and deviceToken are undefined. this is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.nativescript.SampleNotify"
android:versionCode="1"
android:versionName="1.0" >
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="22"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
android:name="org.nativescript.SampleNotify.C2D_MESSAGE" />
<uses-permission android:name="org.nativescript.SampleNotify.C2D_MESSAGE" />
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.tns.NativeScriptActivity"
android:label="#string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
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" />
<!--
IMPORTANT: Change "com.parse.starter" to match your app's package name.
-->
<category android:name="org.nativescript.SampleNotify" />
</intent-filter>
</receiver>
</application>
</manifest>
and this is my code
public void onCreate() {
Parse.initialize(this, "xxxxxxxx", "xxxxxxx");
ParseInstallation.getCurrentInstallation().saveInBackground();
}
I no get any error, but i not get these information
Row in Parse
here a capture, thank you
OK. so, you can check the next:
Ensure your class "com.tns.NativeScriptApplication" are extending from Application (why both packages are different? org.nativescript.SampleNotify != com.tns)
Check my configuration: https://github.com/tiveor/android-advanced/blob/master/ParsePushTest/app/src/main/AndroidManifest.xml
Review your onCreate code that is implementing super.onCreate https://github.com/tiveor/android-advanced/blob/master/ParsePushTest/app/src/main/java/com/possiblelabs/parsepushtest/MyApplication.java
Check your AppId and Client Key (could have some extra space).
If you didn't, you need to add dependency to Google Cloud Messaging Play Services library in order to let Parse get the GCM registration token.
Check dependencies in your build.gradle and add if necessary:
compile "com.google.android.gms:play-services:8.3.0"
Error : Device token Field always null in Parse Installation table.
code
java
ParseInstallation.getCurrentInstallation().saveInBackground();
ParsePush.subscribeInBackground(AppConfig.PARSE_CHANNEL, new SaveCallback() {
#Override
public void done(ParseException e) {
Log.e(TAG, "Successfully subscribed to Parse!");
}
});
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dev.leapup" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
android:name="com.dev.leapup.pushnotifications.permission.C2D_MESSAGE" />
<uses-permission android:name="com.dev.leapup.pushnotifications.permission.C2D_MESSAGE" />
<application
android:name=".application.LeapUpApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".services.LeapUpService"
android:exported="false" >
</service>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
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" />
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications" to match your app's package name.
-->
<category android:name="com.dev.leapup.pushnotifications" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<!-- replace #drawable/push_icon with your push icon identifier -->
<meta-data android:name="com.parse.push.notification_icon" android:resource="#drawable/ic_launcher"/>
</application>
Interesting fact is if use same java code in another project it works, generate the devicetoken. what is the reason, not generating devicetoken for this project , manifest problem?? anything need to change manifest? please help me.
your package name appears to be "com.dev.leapup" however you are incorrectly entering it as "com.dev.leapup.pushnotifications" in your manifest.
as per the comment from Parse
<!--
IMPORTANT: Change "com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission.C2D_MESSAGE".
-->
You should install Google App for having device-token in your device...
it helped me with old devices and genymotion emulator....
see tutorial on Github
see answer on StackOverFlow
Hope this will helps you and others...
following the parse.com tutorial for setting up push notification on android (https://parse.com/tutorials/android-push-notifications). but getting below error:
03-16 14:36:15.280 19899-19952/experties.com.handytask E/com.parse.PushService﹕ Tried to use push, but this app is not configured for push due to: Push is not configured for this app because the app manifest is missing required declarations. Please add the following declarations to your app manifest to support either GCM or PPNS for push (or both). To enable GCM support, please make sure that these permissions are declared as children of the root <manifest> element:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="experties.com.handytask.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="experties.com.handytask.permission.C2D_MESSAGE" />
Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.GcmBroadcastReceiver" 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="experties.com.handytask" />
</intent-filter>
</receiver>
To enable PPNS support, please make sure that these permissions are declared as children of the root <manifest> element:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
Also, please make sure that these services and broadcast receivers are declared as children of the <application> element:
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
My AndroidManifest.xml looks like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="experties.com.handytask" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="experties.com.handytask.permission.C2D_MESSAGE" />
<uses-permission android:name="com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:name=".rest.HandyTaskApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".activities.LoginActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.ShowTasksActivity"
android:label="#string/title_activity_show_tasks" >
</activity>
<activity
android:name=".activities.ChatActivity"
android:label="#string/title_activity_chat" >
</activity>
<uses-library
android:name="com.google.android.maps"
android:required="true" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBFgfG5NRhQj_nC0aFRi7PAyruYG3lbJdg" />
<activity
android:name=".activities.TaskCreationStep1Activity"
android:label="#string/title_activity_task_created" >
</activity>
<activity
android:name=".activities.TaskCreationStep2Activity"
android:label="#string/title_activity_task_creation_step2" >
</activity>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
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="experties.com.handytask" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<meta-data android:name="com.parse.push.notification_icon" android:resource="#drawable/push_icon"/>
</application>
</manifest>
Please suggest what am I doing wrong here?
I refer this posts too, but didn't help.
Android: How to use Parse as an alternative GCM push notification provider?
error setting up push notification using parse.com and android studio
Looking at your manifest, file, I think the problem lies in the following line:
<uses-permission android:name="com.parse.tutorials.pushnotifications.permission.C2D_MESSAGE" />
You need to change com.parse.tutorials to match your app's package name + ".permission.C2D_MESSAGE"
In your case, this would be
<uses-permission android:name="experties.com.handytask.permission.C2D_MESSAGE" />
Basically, your android:name and uses-permission has to match.
I have a problem I`m just not getting any GCM Messages. I dont want Pop Ups or sounds playing, it doesnt even fire the onReceive() Method in the Broadcast Reciever, which is, to my understanding, the first point the Application handles a message.
My biggest problem is I dont get any error messages or Hints. When I send a message, I get the message ID, a multicast ID and a "success=1" message. I also get a "Device registrated on any device and a Reg ID, a "already registered" running the app a second time. The Devices are also logged into Google Play, same account as on the Google API Console. But nothing happens on the Device when I send a GCM Message.
I post my complete android manifest, please let me know if you need more code. This is driving my crazy.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lottoapplicationandroid"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="auto"
>
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="9" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<permission android:name="com.lottoapplicationandroid.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.lottoapplicationandroid.permission.C2D_MESSAGE" />
<!-- App receives GCM messages. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 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" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- ZXing activities -->
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="#string/share_name">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" 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.lottoapplicationandroid" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
EDIT
I dont need a solution for this if not possible. I´d be very thankful for hints how to find out what`s going wrong. E.g. I found out I have to have an open Port 5228. Does anybody know how to check if the devices is listening on that port?
The Issue is solved.
I had to turn Wi-Fi off.
WiFi / Telephone-Network
off / off : not working
on / off : not working
on / on : not working
off / on : working
Aren't you missing some intent filters for the receiver ?
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.lottoapplicationandroid" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.lottoapplicationandroid" />
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="packagename.permission.C2D_MESSAGE" />
<receiver
android:name=".MyBroadcastReceiver"
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="packagename" />
</intent-filter>
</receiver>
<service android:name="Packagename.MyIntentService" >
</service>
Try it hope so it works.