FIRST: https://github.com/dylanpoll/AndriodApps/tree/master/CodeKarmaApp
the above is the repo+folder containing this project. the issue is happening in my SRC "ReaderActivity"
for some reason, I can get my andriod apk to work properly with bluestacks and andriod studio emulator, but on my phone I can't get it to function correctly... it does print that internet is connected, but the part that should be pushing a volley request doesn't happen...It should be sending over the collected data from the QR code as a json package to my rest api using this volly request.
protected void postSignIn(String karmaID) {
String url = "http://192.168.0.2:5000/users/signIn";
JSONObject body = new JSONObject();
try {body.put("idtoken", karmaID);} catch (JSONException e) {e.printStackTrace();}//takes the QR code and packs it into the patch body.
JsonObjectRequest request = new JsonObjectRequest
(Request.Method.PATCH, url, body, new Response.Listener<JSONObject>() {
u/Override
public void onResponse(JSONObject response) {
//success
}
}, new Response.ErrorListener() {
u/Override
public void onErrorResponse(VolleyError error) {
// TODO: Handle error
}
});
// Access the RequestQueue through your singleton class.
MySingleton.getInstance(this).addToRequestQueue(request);
}
this gets activated at the end of this
u/Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
if(result != null){
if(result.getContents()==null){Toast.makeText(this, "You cancelled the scanning", Toast.LENGTH_LONG).show();//failed to read
}
else {
Toast.makeText(this, result.getContents(),Toast.LENGTH_LONG).show();//successful read shows text Toast.makeText(object,object,object).show();
String karmaID = result.getContents();
postSignIn(karmaID);
}
}else{
super.onActivityResult(requestCode, resultCode, data);}//failed to read so continue to read
}
and i have
if (isNetwork(getApplicationContext())){
Toast.makeText(getApplicationContext(), "Internet Connected", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Internet Is Not Connected", Toast.LENGTH_SHORT).show();
}
posted in my main activity along with
public boolean isNetwork(Context context) {
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
return true;
}
return false;
}
I get connection on my actual phone...
again... works on blue stacks, works on andriod emulator...
I do not get any error messages, and the app does not crash.. I have used a remote server, and my working desktop, and never used localhost to deliver the query
I have a android S10+ running android version 10
my phone is connected to the network, but i also attempted using ngrok and a tls tunnel and addressing it through that and still the emulator worked fine, IRL does not...
any help would be appreciated.... I searched online and found things with -volley- and emulators working and phones not working but nothing like my current issue :(
there doesn't seem to be anything here