Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7929073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:57:10+00:00 2026-06-03T19:57:10+00:00

My app is working well on emulator, but when it’s on real android phone

  • 0

My app is working well on emulator, but when it’s on real android phone (sony erricsson xperia, sony ericsson xperia mini) it can’t connect to internet. Phone has active internet connection using EDGE/GPRS.

Here’s the class:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;

public class get_string {


    public String response_p (String url)
    {


            HttpClient client = new DefaultHttpClient();
            HttpGet request = new HttpGet(url.toString());

            ResponseHandler<String> responseHandler = new BasicResponseHandler();
            String response_str = null;
            try {
                response_str = client.execute(request, responseHandler);
            } catch (ClientProtocolException e) {

                response_str="NOT";
            } catch (IOException e) {

                response_str="NOT";
            }

            return response_str;


    }

    public String response (String str)
    {
        String res="";
        try {
            URL url = new URL(str);
            HttpURLConnection con = (HttpURLConnection) url
                .openConnection();
            res=readStream(con.getInputStream());
            } catch (Exception e) {
            res="NOT";
        }



         return res;



    }

    private String readStream(InputStream in) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line = "",res="";
        while ((line = reader.readLine()) != null) {
            res+=line;
        }

        return res;
    }




}

Same result for both response() and response_p().

Here’s the manifest file:

        </application>
       <uses-permission android:name="android.permission.INTERNET"></uses-permission>
       <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
       <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> 
       <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
   </manifest>

How can I solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T19:57:13+00:00Added an answer on June 3, 2026 at 7:57 pm

    I moved both response() and response_p() to my default activity class and it worked!
    I still don’t know why but both functions worked perfectly in emulator and real phone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have swipeleft/swiperight working well in my app but when the user does the
I've got an app inventor app built and working pretty well in the emulator.
I have developed an app for the Android and it's working well, finally, and
I'm working on a visualisation app with Processing. All appears to be going well,
Well this is driving me crazy. I have developed an App-widget. Everything is working
My app is working fine on 2.2 and 2.3 emulators. But when I tried
My app is working on many devices without problems so far. But now I
I have made an android app which working fine. I implemented the Login functionality
I am using a star rating plugin with ExtJS that is working well, but
I would like to use font Wingdings in my app, it is working well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.