Max
Max

Reputation: 348

How to make your app google something?

I made sure that this hasn't been asked before: I want to enhance an app by me. Currently, it shows a dialog telling the user to google something, but that's very unprofessional. There's just a button to open http://www.google.com via Intent and that's it. But I want to make it open a google search link, searching for "%s test search" %s in the strings.xml will be replaced with the device model.

I know, I need to work with replacing parts of strings, so I need spaces replaced with "+" and so on. But how do I do this so I can paste this into the URL?

Upvotes: 0

Views: 60

Answers (1)

Matthew1471
Matthew1471

Reputation: 248

  1. Replacing strings with + etc. is URL encoding (http://www.w3schools.com/tags/ref_urlencode.asp) and so here's how to do this in Java : http://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html

  2. As for Google Search Querystrings, see : https://moz.com/ugc/the-ultimate-guide-to-the-google-search-parameters

You might of course hit some terms of service or terms of use issues, so it might be worth checking with whatever site you link to that you are allowed to use it in that way (like http://www.google.com/intl/en/policies/terms/).

Upvotes: 1

Related Questions