Sending clickable gps long/lat via SMS - android

In my app, I'm getting the user's location using this bit of code:
locationText = location.getLatitude() + "," + location.getLongitude();
...and I'm sending it to another user via SMS using this bit:
smsManager.sendTextMessage(phoneNo, null, locationText, null, null);
... When the other user receives the txt, they get it as "longitude, latitude". Either one is clickable but how would I format the string so when its received, it's clickable as a combined long/lat? I've tried removing the comma (,) but then none of it is clickable. Google searching yielded only how to search using long/lat in google maps. Any and all help is greatly appreciated.
Thank you

Form url like following url link,
http://maps.google.com/maps?q=lat,lng

Related

Get normal google image search results in google custom search API

I want my app to give sample images based on what the user typed.
I created a custom search engine, already ticked "search entire web but emphasise...", and ticked "Image Search".
Created an html GET request as per Google's instructions.
String start = "start=0";
// looking for
String strNoSpaces = toSearchIn.replace(" ", "+");
String url2 = "https://www.googleapis.com/customsearch/v1?"
+ "key=" + keyBrowser
+ "&cx=" + cx
+ "&q=" + strNoSpaces
+ start
+ "&searchtype=image"
+ "&alt=json";
return url2;
and it all works well, I retrieve the image URLs and inflate the grid view.
The problem is the quality of results. It is nowhere near the relevance of what you see on the main google.com search results, and it was kind of my goal. The results that I am getting are rather disappointing and make the whole feature not worth it.
For comparison
my "party" results
Normal search results
Can this be changed with some parameters? I already tried most of them without much difference

replace + with space in html Gmail/Android chrome

Hi i have web application which uses mailto like
Send email
but no meter what i do it alway replace space with + sign
Try to decode your String
just use Uri.encode(String).
subject = (EditText) findViewById(R.id.subject);
subject.setText(Uri.encode(WhatEverYourStringVarIs));
This will help you to decode the URIencode.
If you mean the PHP (HTML) Issue just do the same:
$encodeString = urlencode($encodeString);
echo $encodedString;
So the String will displayed proper.
See this url encode.
Okay, but when i'm read your Question the third time: You can use Spaces in these HTML case. It is an Android Bug. Just use this:
Send Mail

Creating Google Location URL by using latitude & longitude information

I have a code where I'm retrieving latitude and longitude information. I'm interested to show that information on map. I would like to create a link for Google map with retrieved "longitude" and "latitude" information. I am using Linkify for this as follows:
**** Java Code**:
String text = "maps.google.com/?q=latitude,longitude";
TextView label = (TextView)findViewById(R.id.textView);
label.setText(text);
Pattern pattern = Pattern.compile("maps.google.com");
Linkify.addLinks(label, pattern, "http://");
But this code is not working. Can someone help me with code?
I am getting something like following. My longitude and latitude are not getting linked with rest of the url.
you may use below code for displaying map
String url = "geo:" + sLatitude + "," + sLongitude +"?z=22&q="+sLatitude + "," + sLongitude;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
above code shows map using google map application installed in your phone, it also mark the location with zoom level of 22. No google map api key required
Hope this will help...
You may also use the android:autoLink attribute of the TextView to convert the string into links. It controls whether links such as urls and email addresses are automatically found and converted to clickable links.
For example, you may add it in your layout (.xml) file.
<TextView
android:id="#+id/google_map_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web" />
It will automatically convert the text into links for you. Hope it helps you :)

construct predefined messages with properties to post on Facebook android

I want to post a pre-defined message on Facebook through my android application. I got everything to work except the 'properties' field. I want to post a message where it says:
More information: here
and when the user clicks on 'here', it should link to the page.
This is what I did:
Bundle params = new Bundle();
String s2 = "{'More information':{'text':'here', 'href':" + details + "}}";
params.putString("properties", s2);
where 'details' is the link to the page.
But it seems like facebook is not picking up this line. I successfully set up the caption, picture and other fields.
Any insights? Thanks!
This is by design, as far as I know, we do not support HTML in status updates. We will automatically create a link if you post a valid URL however, so I would suggest just pasting out the full link
".....More information: (www.yourURLhere.com)"
On Facebook, www.yourURLhere.com will be a clickable link.

Android linkify an address without displaying the full address

So I'm writing an app for a specific area where the user really doesn't need to see the full address. I want to turn a textview into a map address link, but don't want to have to explicitly type the full address.
Pretty simple, I only want to display the address number and street name, but leave the city, state, and zip out. Does anyone know how I can do this? Here's a chunk of my code.
textView.setText(towedVehicle.getAddress());
Linkify.addLinks(textView, Linkify.MAP_ADDRESSES);
After a little searching I was able to solve it pretty easily
Intent searchAddress = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=address+of+location"));
startActivity(searchAddress);
I made the textview clickable and underlined it to look like a normal link.
SpannableString towedToAddress = new SpannableString(towedVehicle.getTowedToAddress());
towedToAddress.setSpan(new UnderlineSpan(), 0,towedToAddress.length(), 0);
towedToAddress.setSpan(new ForegroundColorSpan(0x990000FF), 0, towedToAddress.length(), 0);
textView.setText(towedToAddress);
textView.setClickable(true);
Opens up in Google maps and works great.
You should be able to do this using Transformfilters in the addLinks method. For an example please check this link.

Categories

Resources