Auto Populate App's Search Box with Text Message Address Hyperlink?

1685
2
Jump to solution
12-16-2016 01:55 PM
KristinSternhagen1
New Contributor II

I will begin with this: I am not much of a developer, and have a limited knowledge of developing apps for Android. But we found this application that does exactly what we need it to do:  https://github.com/Esri/maps-app-android 

It does geolocating, reverse geolocating, and routing in one application, it works perfectly on our devices, and we have done very little configuring since it does everything we need. But, we get calls for service from police dispatch and the address is delivered via text message and the address is displayed as a hyperlink in the text message. I have figured out how to configure it so when this link is clicked, it opens on my phone the app mentioned above, but I want it to auto-populate the search bar in the app with the address from the text message. The other apps on my phone that support this functionality, Google Maps, Zillow, and a couple others, all can do this, but I can't figure out how. Any ideas? 

0 Kudos
1 Solution

Accepted Solutions
DanO_Neill
Occasional Contributor III

I am happy to hear you are using the Maps App and it is filling your needs!  The Maps App uses an Android SearchView, you can use the setQuery() method to set the text in the SearchView from the address in your text message that you send to the app.  An example usage is offered below where you can do this in MapFragment.java where/when you pass the intent with the address string:  

// get the address from intent
String address = intent.getAddress();
// set the search view text
mSearchView.setQuery(address, false);
// clear focus away from search view
mSearchView.clearFocus();

We are active with our GitHub community in the Maps App repo, please do not hesitate to collaborate through our repo as well.  

View solution in original post

0 Kudos
2 Replies
DanO_Neill
Occasional Contributor III

I am happy to hear you are using the Maps App and it is filling your needs!  The Maps App uses an Android SearchView, you can use the setQuery() method to set the text in the SearchView from the address in your text message that you send to the app.  An example usage is offered below where you can do this in MapFragment.java where/when you pass the intent with the address string:  

// get the address from intent
String address = intent.getAddress();
// set the search view text
mSearchView.setQuery(address, false);
// clear focus away from search view
mSearchView.clearFocus();

We are active with our GitHub community in the Maps App repo, please do not hesitate to collaborate through our repo as well.  

0 Kudos
KristinSternhagen1
New Contributor II

Thank you! Your post was very helpful, and I have gotten the app to successfully add the text to the search box, but is there a way to automatically make it search for that address and add the marker at the location - without opening the text editor and clicking the search button?

0 Kudos