Parse Push Notification Exception: "unauthorized: master key is required"
<p>I want to send push Notification using Parse API and GCM. I have done successfully configuration on server and test via sending push notification form Parse terminal and receive at android device.</p>

<p>But when i'm sending push programmatically then got an Exception: <strong>"unauthorized: master key is required"</strong>.</p>

<p>I using following code:</p>

<pre><code>ParseQuery query = ParseInstallation.getQuery();
    query.whereEqualTo("channels", "testing");

    // Notification for Android users
    query.whereEqualTo("deviceType", "android");
    ParsePush androidPush = new ParsePush();
    androidPush.setMessage("Your suitcase has been filled with tiny robots!");
    androidPush.setQuery(query);
    androidPush.sendInBackground(new SendCallback() {
        @Override
        public void done(ParseException e) {
            if ( e == null ) {
                Log.d("GARG","Parse Notification Done. : ");
            } else {
                Log.d("GARG","Notification failed.: "+e.getMessage());
                e.printStackTrace();
            }
        }
    });
</code></pre>

<p>android manifest.xml:</p>

<pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.demo"&gt;

&lt;permission
    android:name="com.demo.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" /&gt;

&lt;uses-permission android:name="com.demo.permission.MAPS_RECEIVE" /&gt;
&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
&lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;


&lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
&lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
&lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
&lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
&lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;

&lt;permission
    android:name="com.demo.permission.C2D_MESSAGE"
    android:protectionLevel="signature" /&gt;

&lt;uses-permission android:name="com.demo.permission.C2D_MESSAGE" /&gt;

&lt;application
    android:name=".AppInitializer"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"&gt;

&lt;service android:name="com.parse.PushService" /&gt;
    &lt;meta-data
        android:name="com.parse.push.notification_icon"
        android:resource="@drawable/ic_cast_light" /&gt;

    &lt;meta-data android:name="com.parse.push.gcm_sender_id"
        android:value="id:211671060483" /&gt;

    &lt;meta-data
        android:name="com.parse.APPLICATION_ID"
        android:value="@string/parse_app_id" /&gt;
    &lt;meta-data
        android:name="com.parse.CLIENT_KEY"
        android:value="@string/parse_client_key" /&gt;

    &lt;meta-data
        android:name="com.parse.X-Parse-Master-Key"
        android:value="@string/parse_master_key" /&gt;

&lt;receiver android:name="com.parse.ParsePushBroadcastReceiver"
        android:exported="false"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="com.parse.push.intent.RECEIVE" /&gt;
            &lt;action android:name="com.parse.push.intent.DELETE" /&gt;
            &lt;action android:name="com.parse.push.intent.OPEN" /&gt;
        &lt;/intent-filter&gt;
    &lt;/receiver&gt;


    &lt;receiver
        android:name="com.parse.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
            &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;


            &lt;category android:name="com.demo" /&gt;
        &lt;/intent-filter&gt;
    &lt;/receiver&gt;

&lt;/application&gt;
</code></pre>

<p>Initialize Parse SDK in android</p>

<pre><code>public class AppInitializer extends Application {

public static JSONObject errorDataProvider;

@Override
public void onCreate() {

    super.onCreate();
    Parse.enableLocalDatastore(getApplicationContext());
    Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
            .applicationId(Utility.ApplicationId)
            .clientKey(Utility.ClientKey)
            .server(Utility.Server_URL)
            .build()
    );

    ParseInstallation.getCurrentInstallation().saveInBackground();

    ParsePush.subscribeInBackground(Utility.PARSE_CHANNEL, new SaveCallback() {
        @Override
        public void done(ParseException e) {
            Log.e("GARG", "Successfully subscribed to Parse!");
        }
    });
    }
 }
</code></pre>