Final fix for GCM

This commit is contained in:
Sylvain Berfini 2012-09-26 16:58:23 +02:00
parent 1536c53a44
commit 0ea5c7b7b3
2 changed files with 1 additions and 8 deletions

View file

@ -50,15 +50,11 @@ public class ApiEightPlus {
String currentPushSenderID = prefs.getString(context.getString(R.string.push_sender_id_key), null); String currentPushSenderID = prefs.getString(context.getString(R.string.push_sender_id_key), null);
if (regId.equals("") || currentPushSenderID == null || !currentPushSenderID.equals(newPushSenderID)) { if (regId.equals("") || currentPushSenderID == null || !currentPushSenderID.equals(newPushSenderID)) {
GCMRegistrar.register(context, newPushSenderID); GCMRegistrar.register(context, newPushSenderID);
String newRegId = GCMRegistrar.getRegistrationId(context);
Log.d("Push Notification : storing current sender id = " + newPushSenderID); Log.d("Push Notification : storing current sender id = " + newPushSenderID);
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
editor.putString(context.getString(R.string.push_sender_id_key), newPushSenderID); editor.putString(context.getString(R.string.push_sender_id_key), newPushSenderID);
Log.d("Push Notification : new id = " + newRegId);
editor.putString(context.getString(R.string.push_reg_id_key), newRegId);
editor.commit(); editor.commit();
} else { } else {
Log.d("Push Notification : already registered with id = " + regId); Log.d("Push Notification : already registered with id = " + regId);

View file

@ -18,8 +18,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
import org.linphone.core.Log;
import android.content.Context; import android.content.Context;
import com.google.android.gcm.GCMBroadcastReceiver; import com.google.android.gcm.GCMBroadcastReceiver;
@ -30,7 +28,6 @@ import com.google.android.gcm.GCMBroadcastReceiver;
public class GCMReceiver extends GCMBroadcastReceiver { public class GCMReceiver extends GCMBroadcastReceiver {
@Override @Override
protected String getGCMIntentServiceClassName(Context context) { protected String getGCMIntentServiceClassName(Context context) {
Log.e("Broadcasting GCM = " + context.getPackageName() + ".gcm.GCMService"); return "org.linphone.gcm.GCMService";
return context.getPackageName() + ".gcm.GCMService";
} }
} }