Push-луч не работает на Android? - PullRequest
0 голосов
/ 20 апреля 2019
The push notification is not showing on my physical android 9.0 device running via USB-debugging mode on android studio.
The publish-id is showing up using curl command but the notification is not showing up on my tray

Я также интегрировал ключ сервера the Curl command shows success

я пробовал несколько раз и даже добавил новые экземпляры луча, но не получал уведомления на моем физическом андроиде 9.0

Я пробовал следующую команду в bash, чтобы вручную получать push-уведомления:

curl -H "Content-Type: application / json" -H "Авторизация: канал 506FDD6A6B85E8105A1965B12CE43C55B1585465E56C00FB6 002836EEA24679C "-X POST" https://58d01970 -5780-4ad5-8431-edf38ec99369.pushnotifications.pusher.com / publish_api / v1 / ins соотечественники, / 58d01970-5780-4ad5-8431-edf38ec99369 / издает "
-d '{"интересов": ["привет"], "fcm": {"уведомление": {"заголовок": "Ад o "," body ":" Привет, мир! "}}} '

android app level build.gradle

    //firebase real time database
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-database:16.1.0'
    //firebase authentiction
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-core:16.0.8'

    implementation 'com.google.firebase:firebase-messaging:17.6.0'

    //pusher
    implementation 'com.pusher:push-notifications-android:1.4.0'

    implementation 'com.pusher:pusher-java-client:1.5.0'

android project level build.gradle


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


android code:




      import android.util.Log;
      import com.pusher.client.PusherOptions;
      import com.pusher.pushnotifications.PushNotifications;
      import com.pusher.client.Pusher;
      import com.pusher.client.channel.Channel;
       import com.pusher.client.channel.SubscriptionEventListener;

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        relativeLayout1=(RelativeLayout) findViewById(R.id.rellay1);
        relativeLayout2=(RelativeLayout)findViewById(R.id.rellay2);
        etUserName=(EditText) findViewById(R.id.etUserName);
        etPassword=(EditText) findViewById(R.id.etPassword);
        btn_Login=(Button) findViewById(R.id.btn_Login);
        btn_SignUp=(Button) findViewById(R.id.btn_SignUp);
        PushNotifications.start(getApplicationContext(), "58d01970-5780-4ad5-8431-edf38ec99369");
        PushNotifications.addDeviceInterest("debug-hello");
        Set<String> interests = PushNotifications.getDeviceInterests();
        Log.i("interests",interests+"");
}
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...