diff --git a/app/src/main/java/config/Config.java b/app/src/main/java/config/Config.java index a15db88..f496fd4 100644 --- a/app/src/main/java/config/Config.java +++ b/app/src/main/java/config/Config.java @@ -3,6 +3,8 @@ public class Config { final public static String CLUSTERURL = "http://ortc-developers.realtime.co/server/2.1/"; + //final public static String CLUSTERURL = null; + final public static String URL = null; final public static String METADATA = "androidApp"; final public static String TOKEN = "token"; final public static String APPKEY = "YOUR_APPLICATION_KEY"; diff --git a/app/src/main/java/handlers/OrtcHandler.java b/app/src/main/java/handlers/OrtcHandler.java index 0bca1b9..c8eef83 100644 --- a/app/src/main/java/handlers/OrtcHandler.java +++ b/app/src/main/java/handlers/OrtcHandler.java @@ -74,7 +74,7 @@ public static void prepareClient(Context context, InterfaceRefresher rootView){ if(Config.CLUSTERURL != null){ client.setClusterUrl(Config.CLUSTERURL); } else { - client.setUrl(Config.CLUSTERURL); + client.setUrl(Config.URL); } client.setApplicationContext(selfHandler.context); diff --git a/app/src/main/java/receiver/GcmReceiver.java b/app/src/main/java/receiver/GcmReceiver.java index 8e71adf..936410f 100644 --- a/app/src/main/java/receiver/GcmReceiver.java +++ b/app/src/main/java/receiver/GcmReceiver.java @@ -9,13 +9,11 @@ import android.support.v4.app.NotificationCompat; import android.util.Log; -import java.util.regex.Matcher; import java.util.regex.Pattern; import co.realtime.messagingandroidchat.MessageActivity; import co.realtime.messagingandroidchat.NotificationActivity; import co.realtime.messagingandroidchat.R; -import ibt.ortc.api.Ortc; import ibt.ortc.extensibility.GcmOrtcBroadcastReceiver; import ibt.ortc.plugins.IbtRealtimeSJ.OrtcMessage; @@ -58,10 +56,18 @@ public void createNotification(Context context, Bundle extras) try { // parsed message format: : + String user = null; + String chatMessage = null; + if(parsedMessage.contains(":")) + { + user = parsedMessage.substring(0, parsedMessage.indexOf(":")); + chatMessage = parsedMessage.substring(parsedMessage.indexOf(":") + 1); + } + else { + user = "Unknown user"; + chatMessage = parsedMessage; + } - String parts [] = parsedMessage.split(":"); - String user = parts[0].split("_")[parts[0].split("_").length - 1]; - String chatMessage = parts[1]; NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Intent notificationIntent = new Intent(context, NotificationActivity.class);