現在、Android で Google GCM プッシュ通知サービスを使用しています。PUSH を完了しましたが、うまく機能しています。ここで、Google サーバーへの登録が成功したときに、サーバーにデバイスの詳細を送信する必要があります。そのため、Activity オブジェクトの参照が必要です。
protected void onRegistered(Context context, String registrationId) {
Log.i(TAG, "Device registered: regId = " + registrationId);
displayMessage(context, getString(R.string.gcm_registered));
registerToMyServer(context, registrationId); //initiate a rest call
// the context above returns application context not the activity context
}
public void registerToMyServer(Activity activity, String rid){
//handing REST
}
誰でもこれで私を助けることができますか?GCMBaseIntentService サブクラスの onRegistered() メソッドから Activity 参照を取得するにはどうすればよいでしょうか。