Ho bisogno di un'applicazione di esempio per la messaggistica di Google Cloud. con un server di esempio per testare la mia app. qualcuno mi può aiutare su questo?Google Cloud messaging - Sample Server
Ho bisogno di un server di esempio per testare il mio codice ho già scritto il codice ma non so che funzionerà o meno. non conosco la codifica lato server, quindi chiunque potrebbe aiutarmi in questo. Ecco il mio codice
servizio intento
package com.example.pushnotificationsample;
import android.content.Context;
public class GCMIntentService extends GCMBaseIntentService {
protected GCMIntentService(String senderId) {
super(senderId);
// TODO Auto-generated constructor stub
}
@Override
protected void onError(Context arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onMessage(Context arg0, Intent msgIntent) {
// TODO Auto-generated method stub
Log.d("GCM", "RECIEVED A MESSAGE");
// String msg=msgIntent.getStringExtra("Message");
Log.d("GCM", msgIntent.toString());
// Get the data from intent and send to notificaion bar
}
@Override
protected void onRegistered(Context arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
protected void onUnregistered(Context arg0, String arg1) {
// TODO Auto-generated method stub
}
}
la mia attività principale
package com.example.pushnotificationsample;
import android.app.Activity;
import com.google.android.gcm.GCMRegistrar;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
GCMRegistrar.checkDevice(this);
// GCMRegistrar.checkManifest(this);
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
GCMRegistrar.register(this, "555817657362");
Log.v("Msg", "registered");
} else {
Log.v("Msg", "Already registered");
}
}
}
Caro se hai scaricato "pacchetto GCM da gestore SDK", allora ci sono esempi per Client, Server. Basta controllare la directory di android-sdk/extras/google/GCM ** –
Tnx molto Paresh – Dinu
@PareshMayani http://chat.stackoverflow.com/transcript/message/4508859#4508859 ma non riesci a trovare in sdk manager in cartella extra – Khan