Я зарегистрировал учетную запись Pusher / Beams для своего приложения для Android.Я был в состоянии установить это без проблем.Но когда я просто создал новый экземпляр pushnotification, я столкнулся с ошибкой.Документация от Pusher использует этот код:
String instanceId = "YOUR_INSTANCE_ID_HERE";
String secretKey = "YOUR_SECRET_KEY_HERE";
PushNotifications pushNotifications = new PushNotifications(instanceId,secretKey);
Однако, когда я буквально копирую и вставляю это в Android Studios, я получаю сообщение об ошибке, что PushNotifications не принимает строки.Я сбит с толку относительно того, почему это происходит.Вот мой код:
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.pusher.pushnotifications.PushNotifications;
public class MainActivity extends AppCompatActivity {
String instanceId = "YOUR_INSTANCE_ID_HERE";
String secretKey = "YOUR_SECRET_KEY_HERE";
PushNotifications pushNotifications = new PushNotifications(instanceId, secretKey);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PushNotifications.start(getApplicationContext(), "my_instance_id");
PushNotifications.subscribe("hello");
}
Вот скриншот ошибки.
![enter image description here](https://i.stack.imgur.com/QbsZi.jpg)