Application crash on test push notification using parsing

As stated in the quick start guide for push notifications, I did everything. But whenever I try to send a test push, the app crashes. I have gone through all the online resources available, but everything seems to be correct except for the execution.

My main-> Application.java

package-> com.virus.buzzkill;

public class BuzzKillApplication extends Application {

    @Override
    public void onCreate() {
          super.onCreate();
          Parse.initialize(this, "YhcMXhTCr65bWiI2RB4voL", "R7QWGNPMjIPh1CHTxZRXxuzgu");
          ParseInstallation.getCurrentInstallation().saveInBackground(); 

        }
}

      

My AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.virus.buzzkill"
    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.RECEIVE_BOOT_COMPLETED" />
    <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" />



    <permission
        android:name="com.virus.buzzkill.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.virus.buzzkill.permission.C2D_MESSAGE" />

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

                <category android:name="com.virus.buzzkill" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

      

Detailed log code

 10-04 20:02:08.544: W/ActivityThread(16322): Application com.virus.buzzkill can be debugged on port 8100...
    10-04 20:02:08.860: I/Adreno-EGL(16322): <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.018_msm8226_LNX.LA.3.5.1_RB1__release_AU ()
    10-04 20:02:08.860: I/Adreno-EGL(16322): OpenGL ES Shader Compiler Version: E031.24.00.08
    10-04 20:02:08.860: I/Adreno-EGL(16322): Build Date: 03/07/14 Fri
    10-04 20:02:08.860: I/Adreno-EGL(16322): Local Branch: 
    10-04 20:02:08.860: I/Adreno-EGL(16322): Remote Branch: quic/LNX.LA.3.5.1_RB1.1
    10-04 20:02:08.860: I/Adreno-EGL(16322): Local Patches: NONE
    10-04 20:02:08.860: I/Adreno-EGL(16322): Reconstruct Branch: AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.018 + f2fd134 +  NOTHING
    10-04 20:02:08.911: D/OpenGLRenderer(16322): Enabling debug mode 0
    10-04 20:02:08.991: D/dalvikvm(16322): GC_FOR_ALLOC freed 480K, 46% free 9407K/17184K, paused 16ms, total 16ms
    10-04 20:02:09.025: I/dalvikvm-heap(16322): Grow heap (frag case) to 23.393MB for 12767920-byte allocation
    10-04 20:02:34.759: I/Activity(16322): Pritish
    10-04 20:02:36.055: D/dalvikvm(16322): GC_FOR_ALLOC freed 1629K, 25% free 22282K/29656K, paused 21ms, total 21ms
    10-04 20:02:50.597: D/AndroidRuntime(16322): Shutting down VM
    10-04 20:02:50.597: W/dalvikvm(16322): threadid=1: thread exiting with uncaught exception (group=0x4169cd40)
    10-04 20:02:50.600: E/AndroidRuntime(16322): FATAL EXCEPTION: main
    10-04 20:02:50.600: E/AndroidRuntime(16322): Process: com.virus.buzzkill, PID: 16322
    10-04 20:02:50.600: E/AndroidRuntime(16322): java.lang.RuntimeException: Unable to start receiver com.parse.ParsePushBroadcastReceiver: java.lang.NullPointerException
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2441)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at android.app.ActivityThread.access$1700(ActivityThread.java:139)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1286)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at android.os.Handler.dispatchMessage(Handler.java:102)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at android.os.Looper.loop(Looper.java:136)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at android.app.ActivityThread.main(ActivityThread.java:5086)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at java.lang.reflect.Method.invokeNative(Native Method)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at java.lang.reflect.Method.invoke(Method.java:515)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at dalvik.system.NativeStart.main(Native Method)
    10-04 20:02:50.600: E/AndroidRuntime(16322): Caused by: java.lang.NullPointerException
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at com.parse.ParsePushBroadcastReceiver.getSmallIconId(ParsePushBroadcastReceiver.java:253)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at com.parse.ParsePushBroadcastReceiver.getNotification(ParsePushBroadcastReceiver.java:335)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at com.parse.ParsePushBroadcastReceiver.onPushReceive(ParsePushBroadcastReceiver.java:143)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at com.parse.ParsePushBroadcastReceiver.onReceive(ParsePushBroadcastReceiver.java:104)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2434)
    10-04 20:02:50.600: E/AndroidRuntime(16322):    ... 10 more

      

Errors in parse notifications in recent log entries. Please, help.

Forever newbie.

+3


source to share


3 answers


add the following line to your AndroidManifest.xml file just before the closing tag </application>

:

    <meta-data android:name="com.parse.push.notification_icon" 
               android:resource="@drawable/push_icon"/>

      



where push_icon

is the name of the resource that can be loaded in your package.

+2


source


There is something weird about Parse and push notifications, I was trying to get it to work correctly as it should (the Parse docs indicate that it will work out of the box the way you do it and you can customize the push notification by extending ParsePushBroadcastReceiver) but ended up doing this to make it work.

Take a look at this answer

fooobar.com/questions/140527 / ...



What you need to do:

  • Extend ParsePushBroadcastReceiver class
  • Use your own class to receive broadcast (in manifest.xml)
  • Override onPushOpen to open your activity manually (or handle the Open action for notification the way you want).
0


source


Try putting this line in your Application class:

PushService.setDefaultPushCallback (this, YourAttivity.class);

This line must be supplied after the Parse.Initialize () statement.

Try it and let me know.

0


source







All Articles