Skip to content

Can i send push to android without using fcm?  #5603

@javadghane

Description

@javadghane

Issue Description

Hi, i'm using parse server v2.3.3 and parse dashboard 1.10.18 on my own server.
after configure the config i can send object and receive them by curl commands.
but for sending push notification to android devices i confused how to configure server.
is need to use FCM for sending pushes? or This is an optional option?
is there any way to using parse server without FCM? in my server i cant have internet some times.
currently i'm getting installation record but push notification doesn't receive to android devices!

Push Configuration

Server is running with this docker image

Android config:
(the google-services.json is added to app directory)

build.gradle

    implementation "com.github.parse-community.Parse-SDK-Android:fcm:1.20.0"
    implementation "com.github.parse-community.Parse-SDK-Android:parse:1.20.0"
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
 Parse.initialize(new Parse.Configuration.Builder(this)
                .applicationId("YOUR_APP_ID")
                .server("http://MyServerIp:1337/parse/")
                .build()
        );
        Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
        ParsePush.subscribeInBackground("myChannel", new SaveCallback() {
            @Override
            public void done(ParseException e) {
                Log.e(LOG_TAG, "Successfully subscribed to Parse!");
            }
        });

        ParseInstallation.getCurrentInstallation().saveInBackground();

Manifest.xml

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

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

Environment Setup

  • Server

    • parse-server version 2.3.3
    • Operating System: ubunut 18.04
    • Localhost or remote server? localhost
  • Database

Logs/Trace

sending push with curl:


curl -X POST \
  http://myServerIp:1337/parse/push \
  -H 'Postman-Token: 6acde416-955f-442a-a697-bd3ec984980f' \
  -H 'X-Parse-Application-Id: YOUR_APP_ID' \
  -H 'X-Parse-Master-Key: YOUR_MASTER_KEY' \
  -H 'X-Parse-REST-API-Key: YOUR_MASTER_KEY' \
  -H 'cache-control: no-cache' \
  -d '{
        "channels": [
          "myChannel"
        ],
        "data": {
        "masterKey": "YOUR_MASTER_KEY",
          "alert": "The Mets scored! The game is now tied 1-1.",
          "badge": "Increment",
          "sound": "cheering.caf",
          "title": "Mets Score!"
        }
      }'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions