Futcho
Futcho

Reputation: 47

android push notification with parse doesen't work

I Downloaded from the parse.com the blanck Android Project, then go to parse.com create the App to get the Application & Client ID KEY, put it on ParseApplication class, run the application it's work fine on my device but when I try to send a push notification I get it the messge .... No registered devices

So, whats wrong?

Any ideas?

public class ParseApplication extends Application {

@Override
public void onCreate() {
super.onCreate();

// Initialize Crash Reporting.
ParseCrashReporting.enable(this);

// Enable Local Datastore.
Parse.enableLocalDatastore(this);

// Add your initialization code here
Parse.initialize(this,"EVIZ5DUourBOfSWykYZIhy4HFgDC0W","HCmjXHOz3SbHnHLlyQVD4uqOnmXdzAy");
ParsePush.subscribeInBackground("", new SaveCallback() {

    @Override
    public void done(com.parse.ParseException e) {
        // TODO Auto-generated method stub
        if (e== null){
            //log.e;
        } else{
            //log.e;
        }

    }
}); 
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
// defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
  }
  }

Manifest File

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.miscore"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="21" />
<!-- Internet permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--
   NUEVO
-->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<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.example.miscore.permission.C2D_MESSAGE" />
<uses-permission android:name="com.example.miscore.permission.C2D_MESSAGE" />


<application
    android:name="com.example.database.BDApplication"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".SplashScreen"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Inicio"
        android:label="@string/inicio"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Configuracion"
        android:label="@string/title_config"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".TablaGeneral"
        android:label="@string/title_activity_tabla_general"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name=".Calendario"
        android:label="@string/title_activity_calendario"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name=".TablaGoleo"
        android:label="@string/title_activity_tabla_goleo"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name=".About"
        android:label="@string/title_activity_about"
        android:screenOrientation="portrait"
        android:theme="@style/TransparentTheme" >
    </activity>
    <activity
        android:name=".CondUso"
        android:label="@string/title_activity_cond_uso" >
    </activity>
    <activity
        android:name=".AvisoPriv"
        android:label="@string/title_activity_aviso_priv" >
    </activity>
    <activity
        android:name=".FirmaLega"
        android:label="@string/title_activity_firma_legal" >
    </activity>
    <!--
           NUEVO
    -->
    <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.example.miscore" />
      </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>
</application>

Upvotes: 0

Views: 87

Answers (1)

Itai Spector
Itai Spector

Reputation: 652

It might sound silly, but try uninstalling your app from your device, and then re-install. Try your code again, if that doesn't help, try do it like this:

ParseInstallation.getCurrentInstallation().put("nameOfColumnInParseInstallationClass", "some relevant data");
ParseInstallation.getCurrentInstallation().saveInBackground...

And then, uninstall and re-install again.

Upvotes: 2

Related Questions