Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Implementing Designs for Android Adding Push Notifications from Parse.com Setting Up Push Notifications

Push notification test was successful but It didn't show the push notification in the emulator

Just as the title implies, the push test was successful. But it didn't show the notification in the status bar. Any help is appreciated, thanks. Oh and I'm using genymotion as my emulator, running a nexus 4 with api 19 (4.4.4).

RibbitApplication.java

package com.teamtreehouse.ribbit;

import android.app.Application;

import com.parse.Parse;
import com.parse.ParseInstallation;

public class RibbitApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Parse.initialize(this,
                "xPvxj9cx2bD4PDv1Doxt8pZFIW47nG70SwVzhlk3",
                "xQS0mVnFFBD5gTN2kf6op0cxZ6Upk3D8wVMfHLri");

        ParseInstallation.getCurrentInstallation().saveInBackground();
    }
}

Build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion '23.0.0'

    defaultConfig {
        applicationId "com.teamtreehouse.ribbit"
        minSdkVersion 14
        targetSdkVersion 19
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile 'com.android.support:support-v4:19.1.0'
    compile files('libs/commons-io-2.4.jar')
    compile files('libs/Parse-1.10.3.jar')
    compile files('libs/picasso-2.1.1.jar')
}

AndroidManifest.xml

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

    <uses-sdk
        android:minSdkVersion="14"
        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.WRITE_EXTERNAL_STORAGE" />
    <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" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />

    <!--
      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.teamtreehouse.ribbit.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.teamtreehouse.ribbit.permission.C2D_MESSAGE" />

    <application
        android:name="com.teamtreehouse.ribbit.RibbitApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Ribbit" >
        <activity
            android:name="com.teamtreehouse.ribbit.ui.MainActivity"
            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="com.teamtreehouse.ribbit.ui.LoginActivity"
            android:label="@string/title_activity_login"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.teamtreehouse.ribbit.ui.SignUpActivity"
            android:label="@string/title_activity_sign_up"
            android:parentActivityName="com.teamtreehouse.ribbit.ui.LoginActivity"
            android:screenOrientation="portrait" >
        </activity>
        <activity
            android:name="com.teamtreehouse.ribbit.ui.EditFriendsActivity"
            android:label="@string/title_activity_edit_friends"
            android:parentActivityName="com.teamtreehouse.ribbit.ui.MainActivity"
            android:screenOrientation="portrait" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.MainActivity" />
        </activity>
        <activity
            android:name="com.teamtreehouse.ribbit.ui.RecipientsActivity"
            android:label="@string/title_activity_recipients"
            android:parentActivityName="com.teamtreehouse.ribbit.ui.MainActivity"
            android:screenOrientation="portrait" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.MainActivity" />
        </activity>
        <activity
            android:name="com.teamtreehouse.ribbit.ui.ViewImageActivity"
            android:label="@string/title_activity_view_image"
            android:parentActivityName="com.teamtreehouse.ribbit.ui.MainActivity"
            android:screenOrientation="portrait">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".ui.MainActivity" />
        </activity>

        <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="com.teamtreehouse.ribbit" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

1 Answer

Andres Badilla
Andres Badilla
4,692 Points

Same is happening to me. Please help!