Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中将onRegistered方法更改为JSONObject_Android_Json_Google Cloud Messaging - Fatal编程技术网

在android中将onRegistered方法更改为JSONObject

在android中将onRegistered方法更改为JSONObject,android,json,google-cloud-messaging,Android,Json,Google Cloud Messaging,我正在我的项目中实施gcm通知。除了GCM意向服务类之外,我能够完成所有任务。下面是我的简历 public class GCMIntentService extends GCMBaseIntentService { private static final String TAG = "GCMIntentService"; public GCMIntentService() { super(SENDER_ID); } /** * M

我正在我的项目中实施gcm通知。除了GCM意向服务类之外,我能够完成所有任务。下面是我的简历

 public class GCMIntentService extends GCMBaseIntentService {

    private static final String TAG = "GCMIntentService";

    public GCMIntentService() {
        super(SENDER_ID);
    }

    /**
     * Method called on device registered
     * @return 
     * @return 
     **/
    protected void onRegistered(Context context, String regId) {
         Log.i(TAG, "Device registered: regId = " + regId);
         UserFunctions userFunction = new UserFunctions();
         JSONObject json= userFunction.registerUser(context,  RegisterUser.password,regId);
        return json;

    }
}

我的问题是
onRegistered
方法,它指示json错误

将方法返回更改为“JSONObject”

请问我怎样才能解决这个问题。提前谢谢

更新

下面是我的UserFunctions类

     /**
      * Function to  Register
      **/
    public JSONObject registerUser(Context context, String password,String regId){
        // Building Parameters
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("tag", register_tag));
        params.add(new BasicNameValuePair("password", password));
        params.add(new BasicNameValuePair("regId", regId));

        //GCMRegistrar.setRegisteredOnServer(context, true);

        JSONObject json = jsonParser.getJSONFromUrl(registerURL,params);
        return json;
    }
/**
*注册函数
**/
公共JSONObject注册表服务器(上下文上下文、字符串密码、字符串注册表){
//建筑参数
List params=new ArrayList();
参数添加(新的BasicNameValuePair(“标记”,寄存器_标记));
添加(新的BasicNameValuePair(“密码”,password));
参数添加(新的BasicNameValuePair(“regId”,regId));
//gcmregistar.setRegisteredOnServer(上下文,true);
JSONObject json=jsonParser.getJSONFromUrl(registerURL,params);
返回json;
}

共享的代码UserFunctions@Pankajkumar已添加用户函数。从上面的问题中进行检查听起来就像导入了两个名为JSONObject的不同类。它不能正确编译吗?