Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
javadghane opened this issue May 20, 2019 · 4 comments
Closed

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

javadghane opened this issue May 20, 2019 · 4 comments

Comments

@javadghane
Copy link

javadghane commented May 20, 2019

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!"
        }
      }'

@davimacedo
Copy link
Member

Yes. Parse Server requires FCM in order to send push notifications to Android devices. Please refer to this guide here on how to setup: https://docs.parseplatform.org/android/guide/#setting-up-push

@mtrezza
Copy link
Member

mtrezza commented May 21, 2019

That is a very interesting question, because FCM requires Google Play Services to be installed on the client.

What if you want to target users in China who mostly do not / cannot use Google services or users who refuse to install Google services out of privacy concerns?

All I can think of is a 3rd party push service that is not depending on FCM, which may not be obvious at first. For example Pushy. These are usually not free.

I opened a related questions on SO you may want to keep an eye on.

@badboy-tian
Copy link

+1

@stale
Copy link

stale bot commented Aug 16, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants