3

I am trying to send push notifications from Bitnami Parse Server (3.1.2) hosted on AWS. I have the server key and the sender ID from firebase in server.js. Notifications work from the firebase console but not from parse server (neither from the dashbord nor from REST API). It says it's saved but Pushes Sent appear 0 even though I have two installations.

Any ideas?

Puhes Sent 0

Puhes Sent 0

My manifest:

<?xml version="1.0" encoding="utf-8"?>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />


<uses-permission android:name="com.parse.starter.permission.C2D_MESSAGE" />
<application
    android:name=".StarterApplication"
    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">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".DepListActivity" />
    <activity android:name=".AngListActivity" />
    <activity android:name=".ChangeThePin" />
    <activity android:name=".PicActivity" />
    <activity android:name=".AddDepActivity" />
    <service
        android:name="com.parse.fcm.ParseFirebaseInstanceIdService"
        android:exported="true">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>

    <service
        android:name="com.parse.fcm.ParseFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>

    <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>

Project Gradle:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        google()
        maven { url "https://jitpack.io" }
    }
}

ext {
    compileSdkVersion = 24
    buildToolsVersion = "24.0.1"

    minSdkVersion = 17
    targetSdkVersion = 24
}

Module gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.parse.starter"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'com.parse.bolts:bolts-tasks:1.3.0'

    implementation 'com.github.parse-community.Parse-SDK-Android:fcm:1.19.0'
    implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.19.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'

    implementation 'com.google.android.gms:play-services-auth:16.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
apply plugin: 'com.google.gms.google-services'

And server.js

var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
// Specify the connection string for your mongodb database
// and the location to your Parse cloud code
var api = new ParseServer({
    databaseURI: "",
    cloud: "./node_modules/parse-server/lib/cloud-code/Parse.Cloud.js",
    appId: "",
    masterKey: "",
    push: {
    android: {
      senderId: "",
      apiKey: ""
    }
  },
    fileKey: "",
    serverURL: ""
});
// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);

var port = 1337;
app.listen(port, function() {
    console.log('parse-server running on port ' + port);
});

//Parse Dashboard
var ParseDashboard = require('parse-dashboard');
var dashboard = new ParseDashboard({
    apps: [
        {
            appName: "My Bitnami Parse API",
            appId: "",
            masterKey: "",
    push: {
    android: {
        senderId: "",
        apiKey: ""
    }
  },
            fileKey: "",
            production: true,
            serverURL: "
        }
    ],
    users: [
        {
            user: "user",
            pass: ""
        }
    ], useEncryptedPasswords: true
});

var allowInsecureHTTP = true;

// Serve the Parse Dashboard on the /parsedashboard URL prefix
app.use('/', dashboard);

var portdash = 4040;
app.listen(portdash, function() {
    console.log('parse-dashboard running on port ' + portdash);
});
Alain Merigot
  • 10,667
  • 3
  • 18
  • 31
VladD
  • 31
  • 1

0 Answers0