可能な二重に緯度、経度や住所を取得する方法:
How to retrieve the GPS location via SMSアンドロイド
私はこのように行動しようとしているアンドロイドアプリ作っています: ユーザータイプをアプリケーションを実行している電話機に「findmyphone」などのテキストメッセージ(他の通常のテキストメッセージには応答しません)が含まれていると、アプリケーションはその番号に緯度、経度、およびthのアドレスで自動的に応答しますアプリケーションを実行している電話。
また、テストするためのボタンが必要です。ユーザーが "Test"ボタンを押すと、緯度、経度、住所が2つのテキストボックスに表示され、緯度と経度が1つに表示され、住所がもう1つのテキストボックスに表示されます。ありがとうございます。これは私がこれまで持っているものです。
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import android.app.Activity;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class FindAndroidActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
Button Nextbutton1, Nextbutton2, TestLocationService;
TextView Cordinates, Adress, FindAndroid;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Nextbutton1 = (Button)findViewById(R.id.Nextbutton1);
Nextbutton1.setOnClickListener(this);
}
public void onClick(View src) {
switch (src.getId()) {
case R.id.Nextbutton1:
setContentView(R.layout.setup);
Nextbutton2 = (Button)findViewById(R.id.Nextbutton2);
Nextbutton2.setOnClickListener(this);
TestLocationService = (Button)findViewById(R.id.TestLocationService);
TestLocationService.setOnClickListener(this);
break;
case R.id.Nextbutton2:
setContentView(R.layout.main);
break;
case R.id.TestLocationService:
break;
}
}
public Address getAddressForLocation(Context context, Location location) throws IOException {
if (location == null) {
return null;
}
double latitude = location.getLatitude();
double longitude = location.getLongitude();
int maxResults = 1;
Geocoder gc = new Geocoder(context, Locale.getDefault());
List<Address> addresses = gc.getFromLocation(latitude, longitude, maxResults);
if (addresses.size() == 1) {
return addresses.get(0);
} else {
return null;
}
}
}
を見てする必要がある「どのように私は、できるだけ簡単にこれを行うことができますか?」あなたのためにこれを行うには誰かに支払う必要があります...これは最も簡単な解決策です... – Selvin
あなたの持つエラーまたは問題は何ですか?誰でも、スモークスクリーン用のコードをコピーして貼り付けることができます。 – Robert
私が必要とするのは、SMSが届くと、緯度、経度、および住所を取得する方法があります。だから私は私の電話を紛失した場合、私は別の電話を貸して、その電話にSMSを送信する: "PhoneLocate"それはその電話のアドレスと座標で応答します。しかし、その単語がPhoneLocateか、私が指定したものだけです。私はすでにアンドロイド市場のアプリケーションを持っていますが、アプリの発明者で作られています。私はそれを日食で作っていきたいと思いますが、その場所での経験はそれほどありません。アプリケーション名はPhoneLocatorです。 – MySoftware