the error is pointing to this requestQueue.add(stringRequest). Everytime i run this app in actual device, it crashes. i declared my Volley requestQue right after service declaration.
public class SmsService extends Service {
public RequestQueue requestQueue;
public StringRequest stringRequest;
stringRequest = new StringRequest(Request.Method.POST, smsurl, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.e("Debug", response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Debug", "No Internet Connection!!");
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("email",email);
hashMap.put("targetname",targetname);
hashMap.put("smstype",smstype);
hashMap.put("phone",phone);
hashMap.put("contactname",contactname);
hashMap.put("body",body);
hashMap.put("date",date);
return hashMap;
}
};
requestQueue.add(stringRequest);