I made a java programme which call and use a xml feed from http://www.somewhereinblog.net/indexblog/rss
and works fine.
But when i made a android version and calling it , the program cant found the host,
because this site has a mobile version which is m.somewhereinblog.net , and whenever i try to call the feed url, it autochanges its url and go to m.somewhereinblog.net/indexblog/rss
which has no feed.
So how can i force my phone to not call the mobile version? any idea or help please
The Website is redirecting your Android program according to the User-Agent headers it receives. The workaround: send desktop User-Agent headers when retrieving the feed. Have a look at http://www.useragentstring.com/pages/useragentstring.php for an exhaustive list of User-Agent headers.
Following your comments - here's a clarification. When a browser connects to a webserver it sends a User-Agent string in its headers. The User-Agent identifies the client request, often specifying the Operating System, version of the browser it is using, etc.
For instance a mobile browser running Android might identify itself as:
User-Agent: Mozilla/5.0 (Linux; U; Android 2.2.1; en-ca; LG-P505R Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Whereas a desktop browser on Windows 8 might send something like:
User-Agent: Mozilla/6.0 (Windows NT 6.2; WOW64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1
Notice in the examples above that the User-Agent contains information about the operating system and the version and name of the browser originating the request. Webservers use this information to determine which pages should be served.
Since your program on Android is being redirected to a mobile page when requesting a feed, it is highly probable that the API you are using on Android to generate the request is sending a User-Agent string identifying it as a mobile device.
The workaround is to override the User-Agent string which is being sent in the headers so that the webserver thinks that the request is coming from a desktop system. This is the reason why I posted the link to the list of User-Agent strings - so that you can select and test different settings.
To sum up - you do not need to request a different URL - request the feed from the same URL as the desktop version but ensure that the User-Agent string in the headers passed to the webserver identifies the request as coming from a desktop browser and not a mobile one to avoid being redirected to the mobile version.