@Override public void subscribeToPushChannel(String channel) { FirebaseMessaging.getInstance().subscribeToTopic(channel); }
@Override public void unsubscribeToPushChannel(String channel) { FirebaseMessaging.getInstance().unsubscribeFromTopic(channel); }
/** * Gets the {@link FirebaseMessaging} instance for the default {@link FirebaseApp}. * * @return The {@link FirebaseMessaging} instance for the default {@link FirebaseApp}. */ public static FirebaseMessaging getInstance() { return getInstance(FirebaseApp.getInstance()); }
private void updateTopicSubscriptions(Set<String> newTopics, String[] availableTopics) { if (newTopics != null) { for (String availableTopic : availableTopics) { if (newTopics.contains(availableTopic)) { FirebaseMessaging.getInstance().subscribeToTopic(availableTopic); } else { FirebaseMessaging.getInstance().unsubscribeFromTopic(availableTopic); } } } }
private void subscribeTpcs(String token) throws IOException { FirebaseMessaging.getInstance().subscribeToTopic(GcmActivity.myIdentity()); for (String tpc : PREDEF) { FirebaseMessaging.getInstance().subscribeToTopic(tpc); } } }
private void subscribeTpcs(String token) throws IOException { FirebaseMessaging.getInstance().subscribeToTopic(GcmActivity.myIdentity()); for (String tpc : PREDEF) { FirebaseMessaging.getInstance().subscribeToTopic(tpc); } } }
@Override public void onReceive(Context context, Intent intent) { // checking for type intent filter if (intent.getAction().equals(Config.REGISTRATION_COMPLETE)) { // gcm successfully registered // now subscribe to `global` topic to receive app wide notifications FirebaseMessaging.getInstance().subscribeToTopic(Config.TOPIC_GLOBAL); Toast.makeText(getApplicationContext(), "Push notification: " + "123456", Toast.LENGTH_LONG).show(); displayFirebaseRegId(); } else if (intent.getAction().equals(Config.PUSH_NOTIFICATION)) { // new push notification is received String message = intent.getStringExtra("message"); Toast.makeText(getApplicationContext(), "Push notification: " + message, Toast.LENGTH_LONG).show(); // txtMessage.setText(message); } } };
@Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()){ FirebaseMessaging.getInstance().subscribeToTopic(String.valueOf(lessonInfo.getChannelId())); Toast.makeText(SubscribeActivity.this,"Subscribed : "+lessonInfo.getChannelId(),Toast.LENGTH_SHORT).show(); } } });
private void setupFirebasePushNotification(String token) { Log.d("AnyAudio", "token:" + token); //Subscribe to topics if opted and not yet subscribed SharedPrefrenceUtils sharedPrefrenceUtils = SharedPrefrenceUtils.getInstance(this); sharedPrefrenceUtils.setFcmToken(token); //if (!sharedPrefrenceUtils.donotRemindForAppUpdate() && !sharedPrefrenceUtils.subscribedForUpdate()) { //subscribe FirebaseMessaging.getInstance().subscribeToTopic(Constants.FIREBASE.TOPIC_UPDATE); sharedPrefrenceUtils.setSubscribedForUpdate(true); //} // if (sharedPrefrenceUtils.subscribeForDefaults_get()) { Log.d("AnyAudio", "Subscribing to Topics"); FirebaseMessaging.getInstance().subscribeToTopic(Constants.FIREBASE.TOPIC_RECOMMEND); FirebaseMessaging.getInstance().subscribeToTopic(Constants.FIREBASE.TOPIC_EVE); sharedPrefrenceUtils.subscribeForDefaults_set(false); //} }
@Override public void onTokenRefresh() { String token = FirebaseInstanceId.getInstance().getToken(); Log.d("Token",token); registerToken(token); FirebaseMessaging.getInstance().subscribeToTopic("test"); }
private static void fmSend(Bundle data) { final FirebaseMessaging fm = FirebaseMessaging.getInstance(); if (senderid != null) { fm.send(new RemoteMessage.Builder(senderid + "@gcm.googleapis.com") .setMessageId(Integer.toString(msgId.incrementAndGet())) .setData(JoH.bundleToMap(data)) .build()); } else { Log.wtf(TAG, "senderid is null"); } }
private static void fmSend(Bundle data) { final FirebaseMessaging fm = FirebaseMessaging.getInstance(); if (senderid != null) { fm.send(new RemoteMessage.Builder(senderid + "@gcm.googleapis.com") .setMessageId(Integer.toString(msgId.incrementAndGet())) .setData(JoH.bundleToMap(data)) .build()); } else { Log.wtf(TAG, "senderid is null"); } }
@Override public void onCreate() { super.onCreate(); CalligraphyConfig.initDefault( new CalligraphyConfig.Builder().setDefaultFontPath("minyna.ttf").setFontAttrId(R.attr.fontPath) .build()); AndroidThreeTen.init(this); FirebaseApp.initializeApp(this); FirebaseMessaging.getInstance().subscribeToTopic("Power_Notifications"); }
onNewIntent(getIntent()); if (Global.isPlaystoreAvailable(this)) { FirebaseMessaging.getInstance().subscribeToTopic("playstore_users_notifications");; } else { FirebaseMessaging.getInstance().subscribeToTopic("non_playstore_users_notifications");
private void sendNotification(DeviceInfo device, String notificationBase64) { Message msg = Message.builder() .putData("notification", notificationBase64) .setToken(device.fcm_device_info.token) .build(); try { String resp = FirebaseMessaging.getInstance().send(msg); log.info("Firebase message sent: %s", resp); } catch(FirebaseMessagingException e) { log.error("Error sending firebase notification: %s", e.getErrorCode(), e); } } }
FirebaseMessaging.getInstance() .subscribeToTopic(Constants.TOPIC_TRIPLE_DOUBLES); } else { FirebaseMessaging.getInstance() .unsubscribeFromTopic(Constants.TOPIC_TRIPLE_DOUBLES); FirebaseMessaging.getInstance() .subscribeToTopic(Constants.TOPIC_QUADRUPLE_DOUBLES); } else { FirebaseMessaging.getInstance() .unsubscribeFromTopic(Constants.TOPIC_QUADRUPLE_DOUBLES); FirebaseMessaging.getInstance() .subscribeToTopic(Constants.TOPIC_5_X_5); } else { FirebaseMessaging.getInstance() .unsubscribeFromTopic(Constants.TOPIC_5_X_5);
if ((GcmActivity.myIdentity() != null) && (GcmActivity.myIdentity().length() > 30)) { try { FirebaseMessaging.getInstance().unsubscribeFromTopic(tpca[2]); } catch (Exception e) { Log.e(TAG, "Exception unsubscribing: " + e.toString());
if ((GcmActivity.myIdentity() != null) && (GcmActivity.myIdentity().length() > 30)) { try { FirebaseMessaging.getInstance().unsubscribeFromTopic(tpca[2]); } catch (Exception e) { Log.e(TAG, "Exception unsubscribing: " + e.toString());