I hope help me to fund a good tutorial for send push notification to android app using php without external cloud like firebase , just php in my localhost to Android app
If yes, how can I do it?
You couldn't push notification without using cloud service, but you can request for some data from a server and get a response without using cloud service. You can use network libray like volley
and retrofit
. Here I shows an example of volley
Add the following dependency in your app gradle
dependencies {
compile 'com.android.volley:volley:1.0.0'
}
Add internet permission in your manifest
<uses-permission android:name="android.permission.INTERNET" />
And add the following in your activity
//specify url
String url = "https:yourIpAddress/file.php";
// make a request
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.GET,
url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d(TAG, response.toString());
//Success
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
//Error
}
});
//Make a request queue
RequestQueue mRequestQueue = Volley.newRequestQueue(getApplicationContext());
//Add request to requestQueue
mRequestQueue.add(jsonObjReq);
For more details refer enter link description here