android怎么获取用户所在地 csdn

如上面所说

三种方式进行定位,获取用户位置,分别是基于基站定位, 网络定位,GPS定位。

1.基站定位(passive):这是基于网络基站进行定位的,定位的精确度在几十米到几千米不等,在城市中基站覆盖率比较高,推荐使用基站定位,如果是在郊区,基站相距较远,基站的覆盖没有城里好,定位的误差比较大。如果在郊区不推荐使用基站定位。

2.网络定位:wifi定位,网络定位

3.GPS定位:与卫星进行通信。手机中嵌入了GPS模块(精简版的A-GPS),通过A-GPS搜索卫星, 获取经纬度。使用GPS的弊端是:必须站在空旷的地方,头顶对着天空,如果云层厚了,也会受到一定的影响。精确度:10-50米

扩展知识:

使用Android是定位必备的权限:
< uses-permission android:name= " android.permission.ACCESS_FINE_LOCATION " />      //精确定位
<uses-permission android:name= "android.permission.ACCESS_MOCK_LOCATION" />      //模拟器
<uses-permission android:name= "android.permission.ACCESS_COARSE_LOCATION" />   //粗糙定位
 
//获取定位管理对象
LocationManager  lm=(LocationManager)getSystemService(LOCATION_SERVICE);
String[] names=lm.getAllProviders();//获取所有的位置提供者,一般三种

Criteria  criteria=new Criteria();//查询条件,如果设置了海拔,则定位方式只能是GPS;
criteria.setCostAllowed(true);//是否产生开销,比如流量费
String provider=lm.getBaseProvider(criteria,true)//获取最好的位置提供者,第二个参数为true,表示只获取那些被打开的位置提供者

lm.requestLocationUpdates(provier,0,0,new LocationListener(){});//获取位置。第二个参数表示每隔多少时间返回一次数据,第三个参数表示被定位的物体移动每次多少米返回一次数据。

private class MyLocationListener implements LocationListener {
            @Override
            public void onStatusChanged(String provider, int status, Bundle extras) {

           }

            @Override
            public void onProviderEnabled(String provider) {

           }

            @Override
         


            @Override
            public void onLocationChanged(Location location) {
                 System. out.println( "服务中位置监听发送了变化了" );
                  float accuracy = location.getAccuracy(); // ç²¾ç¡®åº¦
                  double altitude = location.getAltitude(); // æµ·æ‹”
                  double latitude = location.getLatitude(); // çº¬åº¦
                  double longitude = location.getLongitude(); // ç»åº¦
                 String locationInfo = "jingdu:" + longitude + ",weidu:" + latitude + ",haiba:" + altitude + ",jingquedu:" + accuracy;
                 Editor edit = sp.edit();
                 edit.putString( "location", locationInfo);
                 edit.commit();
           }
     }   public void onProviderDisabled(String provider) {

           }
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-07-18
在很多生活类工具应用中都会包含用户位置信息,这样更方便的为用户服务。 经常我们使用三种方式进行定位,获取用户位置,分别是基于基站定位, 网络定位,GPS定位。

一:基站定位(passive):这是基于网络基站进行定位的,定位的精确度在几十米到几千米不等,在城市中基站覆盖率比较高,推荐使用基站定位,如果是在郊区,基站相距较远,基站的覆盖没有城里好,定位的误差比较大。如果在郊区不推荐使用基站定位。

二:网络定位:wifi定位,网络定位
运营商下放IP地址。比如彩虹QQ。
google纵横(统计一个非常大的IP和地址映射关系)
动态IP(IP池中随机获取一个IP地址,每次联网都会去池中获取一个随机的IP ,得到的是一个大体的地址),比如新浪微博。天气定位

方式三:GPS定位
与卫星进行通信。
手机中嵌入了GPS模块(精简版的A-GPS),通过A-GPS搜索卫星, 获取经纬度。
使用GPS的弊端是:必须站在空旷的地方,头顶对着天空,如果云层厚了,也会受到一定的影响。
精确度:10-50米
-------------------------------------------------------------------------------------------
使用Android是定位必备的权限:
< uses-permission android:name= " android.permission.ACCESS_FINE_LOCATION " /> //精确定位
<uses-permission android:name= "android.permission.ACCESS_MOCK_LOCATION" /> //模拟器
<uses-permission android:name= "android.permission.ACCESS_COARSE_LOCATION" /> //粗糙定位

//获取定位管理对象
LocationManager lm=(LocationManager)getSystemService(LOCATION_SERVICE);
String[] names=lm.getAllProviders();//获取所有的位置提供者,一般三种

Criteria criteria=new Criteria();//查询条件,如果设置了海拔,则定位方式只能是GPS;
criteria.setCostAllowed(true);//是否产生开销,比如流量费
String provider=lm.getBaseProvider(criteria,true)//获取最好的位置提供者,第二个参数为true,表示只获取那些被打开的位置提供者

lm.requestLocationUpdates(provier,0,0,new LocationListener(){});//获取位置。第二个参数表示每隔多少时间返回一次数据,第三个参数表示被定位的物体移动每次多少米返回一次数据。

private class MyLocationListener implements LocationListener {
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {

}

@Override
public void onProviderEnabled(String provider) {

}

@Override
public void onProviderDisabled(String provider) {

}

@Override
public void onLocationChanged(Location location) {
System. out.println( "服务中位置监听发送了变化了" );
float accuracy = location.getAccuracy(); // 精确度
double altitude = location.getAltitude(); // 海拔
double latitude = location.getLatitude(); // 纬度
double longitude = location.getLongitude(); // 经度
String locationInfo = "jingdu:" + longitude + ",weidu:" + latitude + ",haiba:" + altitude + ",jingquedu:" + accuracy;
Editor edit = sp.edit();
edit.putString( "location", locationInfo);
edit.commit();
}
}
第2个回答  2015-01-10
最近在做一个互联网项目,不可避免和其他互联网项目一样,需要各种类似的功能。其中一个就是通过用户访问网站的IP地址显示当前用户所在地。在没有查阅资料之前,我第一个想到的是应该有这样的RESTFUL服务,可能会有免费的,也有可能会是收费的。后来查阅了相关资料和咨询了客服人员发现了一款相当不错的库:GEOIP。

首先来个Java 版本:

[java]
import java.net.MalformedURLException;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class OmniReader {
public static void main(String[] args) throws Exception {
String license_key = "YOUR_LICENSE_KEY";
String ip_address = "24.24.24.24";

String url_str = "http。//geoip。maxmind。com/e?l=" + license_key + "&i=" + ip_address;

URL url = new URL(url_str);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inLine;

while ((inLine = in.readLine()) != null) {
// Alternatively use a CSV parser here.
Pattern p = Pattern.compile("\"([^\"]*)\"|(?<=,|^)([^,]*)(?:,|$)");
Matcher m = p.matcher(inLine);

ArrayList fields = new ArrayList();
String f;
while (m.find()) {
f = m.group(1);
if (f!=null) {
fields.add(f);
}
else {
fields.add(m.group(2));
}
}

String countrycode = fields.get(0);
String countryname = fields.get(1);
String regioncode = fields.get(2);
String regionname = fields.get(3);
String city = fields.get(4);
String lat = fields.get(5);
String lon = fields.get(6);
String metrocode = fields.get(7);
String areacode = fields.get(8);
String timezone = fields.get(9);
String continent = fields.get(10);
String postalcode = fields.get(11);
String isp = fields.get(12);
String org = fields.get(13);
String domain = fields.get(14);
String asnum = fields.get(15);
String netspeed = fields.get(16);
String usertype = fields.get(17);
String accuracyradius = fields.get(18);
String countryconf = fields.get(19);
String cityconf = fields.get(20);
String regionconf = fields.get(21);
String postalconf = fields.get(22);
String error = fields.get(23);
}

in.close();
}
}
import java.net.MalformedURLException;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class OmniReader {
public static void main(String[] args) throws Exception {
String license_key = "YOUR_LICENSE_KEY";
String ip_address = "24.24.24.24";
String url_str = "http。//geoip。maxmind。com/e?l=" + license_key + "&i=" + ip_address;
URL url = new URL(url_str);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inLine;

while ((inLine = in.readLine()) != null) {
// Alternatively use a CSV parser here.
Pattern p = Pattern.compile("\"([^\"]*)\"|(?<=,|^)([^,]*)(?:,|$)");
Matcher m = p.matcher(inLine);
ArrayList fields = new ArrayList();
String f;
while (m.find()) {
f = m.group(1);
if (f!=null) {
fields.add(f);
}
else {
fields.add(m.group(2));
}
}

String countrycode = fields.get(0);
String countryname = fields.get(1);
String regioncode = fields.get(2);
String regionname = fields.get(3);
String city = fields.get(4);
String lat = fields.get(5);
String lon = fields.get(6);
String metrocode = fields.get(7);
String areacode = fields.get(8);
String timezone = fields.get(9);
String continent = fields.get(10);
String postalcode = fields.get(11);
String isp = fields.get(12);
String org = fields.get(13);
String domain = fields.get(14);
String asnum = fields.get(15);
String netspeed = fields.get(16);
String usertype = fields.get(17);
String accuracyradius = fields.get(18);
String countryconf = fields.get(19);
String cityconf = fields.get(20);
String regionconf = fields.get(21);
String postalconf = fields.get(22);
String error = fields.get(23);
}
in.close();
}
}
C#版本:

[csharp]
private string GetMaxMindOmniData(string IP) {
System.Uri objUrl = new System.Uri("http。//geoip。maxmind。com/e?l=YOUR_LICENSE_KEY&i=" + IP);
System.Net.WebRequest objWebReq;
System.Net.WebResponse objResp;
System.IO.StreamReader sReader;
string strReturn = string.Empty;

try
{
objWebReq = System.Net.WebRequest.Create(objUrl);
objResp = objWebReq.GetResponse();

sReader = new System.IO.StreamReader(objResp.GetResponseStream());
strReturn = sReader.ReadToEnd();

sReader.Close();
objResp.Close();
}
catch (Exception ex)
{
}
finally
{
objWebReq = null;
}

return strReturn;
}
private string GetMaxMindOmniData(string IP) {
System.Uri objUrl = new System.Uri("http。//geoip。maxmind。com/e?l=YOUR_LICENSE_KEY&i=" + IP);
System.Net.WebRequest objWebReq;
System.Net.WebResponse objResp;
System.IO.StreamReader sReader;
string strReturn = string.Empty;
try
{
objWebReq = System.Net.WebRequest.Create(objUrl);
objResp = objWebReq.GetResponse();
sReader = new System.IO.StreamReader(objResp.GetResponseStream());
strReturn = sReader.ReadToEnd();
sReader.Close();
objResp.Close();
}
catch (Exception ex)
{
}
finally
{
objWebReq = null;
}
return strReturn;
}
Ruby版本:

[ruby]
#!/usr/bin/env ruby

require 'csv'
require 'net/http'
require 'open-uri'
require 'optparse'
require 'uri'

fields = [:country_code,
:country_name,
:region_code,
:region_name,
:city_name,
:latitude,
:longitude,
:metro_code,
:area_code,
:time_zone,
:continent_code,
:postal_code,
:isp_name,
:organization_name,
:domain,
:as_number,
:netspeed,
:user_type,
:accuracy_radius,
:country_confidence,
:city_confidence,
:region_confidence,
:postal_confidence,
:error]

options = { :license => "YOUR_LICENSE_KEY", :ip => "24.24.24.24" }
OptionParser.new { |opts|
opts.banner = "Usage: omni-geoip-ws.rb [options]"

opts.on("-l", "--license LICENSE", "MaxMind license key") do |l|
options[:license] = l
end

opts.on("-i", "--ip IPADDRESS", "IP address to look up") do |i|
options[:ip] = i
end
}.parse!

uri = URI::HTTP.build(:scheme => 'http',
:host => 'geoip.maxmind.com',
:path => '/e',
:query => URI.encode_www_form(:l => options[:license],
:i => options[:ip]))

response = Net::HTTP.get_response(uri)

unless response.is_a?(Net::HTTPSuccess)
abort "Request failed with status #{response.code}"
end

omni = Hash[fields.zip(response.body.encode('utf-8', 'iso-8859-1').parse_csv)]

if omni[:error]
abort "MaxMind returned an error code for the request: #{omni[:error]}"
else
puts
puts "MaxMind Omni data for #{options[:ip]}";
puts
omni.each { |key, val| printf " %-20s %s\n", key, val }
puts
end
#!/usr/bin/env ruby
require 'csv'
require 'net/http'
require 'open-uri'
require 'optparse'
require 'uri'
fields = [:country_code,
:country_name,
:region_code,
:region_name,
:city_name,
:latitude,
:longitude,
:metro_code,
:area_code,
:time_zone,
:continent_code,
:postal_code,
:isp_name,
:organization_name,
:domain,
:as_number,
:netspeed,
:user_type,
:accuracy_radius,
:country_confidence,
:city_confidence,
:region_confidence,
:postal_confidence,
:error]
options = { :license => "YOUR_LICENSE_KEY", :ip => "24.24.24.24" }
OptionParser.new { |opts|
opts.banner = "Usage: omni-geoip-ws.rb [options]"
opts.on("-l", "--license LICENSE", "MaxMind license key") do |l|
options[:license] = l
end
opts.on("-i", "--ip IPADDRESS", "IP address to look up") do |i|
options[:ip] = i
end
}.parse!
uri = URI::HTTP.build(:scheme => 'http',
:host => 'geoip.maxmind.com',
:path => '/e',
:query => URI.encode_www_form(:l => options[:license],
:i => options[:ip]))
response = Net::HTTP.get_response(uri)
unless response.is_a?(Net::HTTPSuccess)
abort "Request failed with status #{response.code}"
end
omni = Hash[fields.zip(response.body.encode('utf-8', 'iso-8859-1').parse_csv)]
if omni[:error]
abort "MaxMind returned an error code for the request: #{omni[:error]}"
else
puts
puts "MaxMind Omni data for #{options[:ip]}";
puts
omni.each { |key, val| printf " %-20s %s\n", key, val }
puts
end
第3个回答  2015-08-02
最近在做一个互联网项目,不可避免和其他互联网项目一样,需要各种类似的功能。其中一个就是通过用户访问网站的IP地址显示当前用户所在地。在没有查阅资料之前,我第一个想到的是应该有这样的RESTFUL服务,可能会有免费的,也有可能会是收费的。后来查阅了相关资料和咨询了客服人员发现了一款相当不错的库:GEOIP。

首先来个Java 版本:

[java]
import java.net.MalformedURLException;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class OmniReader {
public static void main(String[] args) throws Exception {
String license_key = "YOUR_LICENSE_KEY";
String ip_address = "24.24.24.24";

String url_str = "http。//geoip。maxmind。com/e?l=" + license_key + "&i=" + ip_address;

URL url = new URL(url_str);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inLine;

while ((inLine = in.readLine()) != null) {
// Alternatively use a CSV parser here.
Pattern p = Pattern.compile("\"([^\"]*)\"|(?<=,|^)([^,]*)(?:,|$)");
Matcher m = p.matcher(inLine);

ArrayList fields = new ArrayList();
String f;
while (m.find()) {
f = m.group(1);
if (f!=null) {
fields.add(f);
}
else {
fields.add(m.group(2));
}
}

String countrycode = fields.get(0);
String countryname = fields.get(1);
String regioncode = fields.get(2);
String regionname = fields.get(3);
String city = fields.get(4);
String lat = fields.get(5);
String lon = fields.get(6);
String metrocode = fields.get(7);
String areacode = fields.get(8);
String timezone = fields.get(9);
String continent = fields.get(10);
String postalcode = fields.get(11);
String isp = fields.get(12);
String org = fields.get(13);
String domain = fields.get(14);
String asnum = fields.get(15);
String netspeed = fields.get(16);
String usertype = fields.get(17);
String accuracyradius = fields.get(18);
String countryconf = fields.get(19);
String cityconf = fields.get(20);
String regionconf = fields.get(21);
String postalconf = fields.get(22);
String error = fields.get(23);
}

in.close();
}
}
import java.net.MalformedURLException;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class OmniReader {
public static void main(String[] args) throws Exception {
String license_key = "YOUR_LICENSE_KEY";
String ip_address = "24.24.24.24";
String url_str = "http。//geoip。maxmind。com/e?l=" + license_key + "&i=" + ip_address;
URL url = new URL(url_str);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inLine;

while ((inLine = in.readLine()) != null) {
// Alternatively use a CSV parser here.
Pattern p = Pattern.compile("\"([^\"]*)\"|(?<=,|^)([^,]*)(?:,|$)");
Matcher m = p.matcher(inLine);
ArrayList fields = new ArrayList();
String f;
while (m.find()) {
f = m.group(1);
if (f!=null) {
fields.add(f);
}
else {
fields.add(m.group(2));
}
}

String countrycode = fields.get(0);
String countryname = fields.get(1);
String regioncode = fields.get(2);
String regionname = fields.get(3);
String city = fields.get(4);
String lat = fields.get(5);
String lon = fields.get(6);
String metrocode = fields.get(7);
String areacode = fields.get(8);
String timezone = fields.get(9);
String continent = fields.get(10);
String postalcode = fields.get(11);
String isp = fields.get(12);
String org = fields.get(13);
String domain = fields.get(14);
String asnum = fields.get(15);
String netspeed = fields.get(16);
String usertype = fields.get(17);
String accuracyradius = fields.get(18);
String countryconf = fields.get(19);
String cityconf = fields.get(20);
String regionconf = fields.get(21);
String postalconf = fields.get(22);
String error = fields.get(23);
}
in.close();
}
}
C#版本:

[csharp]
private string GetMaxMindOmniData(string IP) {
System.Uri objUrl = new System.Uri("http。//geoip。maxmind。com/e?l=YOUR_LICENSE_KEY&i=" + IP);
System.Net.WebRequest objWebReq;
System.Net.WebResponse objResp;
System.IO.StreamReader sReader;
string strReturn = string.Empty;

try
{
objWebReq = System.Net.WebRequest.Create(objUrl);
objResp = objWebReq.GetResponse();

sReader = new System.IO.StreamReader(objResp.GetResponseStream());
strReturn = sReader.ReadToEnd();

sReader.Close();
objResp.Close();
}
catch (Exception ex)
{
}
finally
{
objWebReq = null;
}

return strReturn;
}
private string GetMaxMindOmniData(string IP) {
System.Uri objUrl = new System.Uri("http。//geoip。maxmind。com/e?l=YOUR_LICENSE_KEY&i=" + IP);
System.Net.WebRequest objWebReq;
System.Net.WebResponse objResp;
System.IO.StreamReader sReader;
string strReturn = string.Empty;
try
{
objWebReq = System.Net.WebRequest.Create(objUrl);
objResp = objWebReq.GetResponse();
sReader = new System.IO.StreamReader(objResp.GetResponseStream());
strReturn = sReader.ReadToEnd();
sReader.Close();
objResp.Close();
}
catch (Exception ex)
{
}
finally
{
objWebReq = null;
}
return strReturn;
}
Ruby版本:

[ruby]
#!/usr/bin/env ruby

require 'csv'
require 'net/http'
require 'open-uri'
require 'optparse'
require 'uri'

fields = [:country_code,
:country_name,
:region_code,
:region_name,
:city_name,
:latitude,
:longitude,
:metro_code,
:area_code,
:time_zone,
:continent_code,
:postal_code,
:isp_name,
:organization_name,
:domain,
:as_number,
:netspeed,
:user_type,
:accuracy_radius,
:country_confidence,
:city_confidence,
:region_confidence,
:postal_confidence,
:error]

options = { :license => "YOUR_LICENSE_KEY", :ip => "24.24.24.24" }
OptionParser.new { |opts|
opts.banner = "Usage: omni-geoip-ws.rb [options]"

opts.on("-l", "--license LICENSE", "MaxMind license key") do |l|
options[:license] = l
end

opts.on("-i", "--ip IPADDRESS", "IP address to look up") do |i|
options[:ip] = i
end
}.parse!

uri = URI::HTTP.build(:scheme => 'http',
:host => 'geoip.maxmind.com',
:path => '/e',
:query => URI.encode_www_form(:l => options[:license],
:i => options[:ip]))

response = Net::HTTP.get_response(uri)

unless response.is_a?(Net::HTTPSuccess)
abort "Request failed with status #{response.code}"
end

omni = Hash[fields.zip(response.body.encode('utf-8', 'iso-8859-1').parse_csv)]

if omni[:error]
abort "MaxMind returned an error code for the request: #{omni[:error]}"
else
puts
puts "MaxMind Omni data for #{options[:ip]}";
puts
omni.each { |key, val| printf " %-20s %s\n", key, val }
puts
end
#!/usr/bin/env ruby
require 'csv'
require 'net/http'
require 'open-uri'
require 'optparse'
require 'uri'
fields = [:country_code,
:country_name,
:region_code,
:region_name,
:city_name,
:latitude,
:longitude,
:metro_code,
:area_code,
:time_zone,
:continent_code,
:postal_code,
:isp_name,
:organization_name,
:domain,
:as_number,
:netspeed,
:user_type,
:accuracy_radius,
:country_confidence,
:city_confidence,
:region_confidence,
:postal_confidence,
:error]
options = { :license => "YOUR_LICENSE_KEY", :ip => "24.24.24.24" }
OptionParser.new { |opts|
opts.banner = "Usage: omni-geoip-ws.rb [options]"
opts.on("-l", "--license LICENSE", "MaxMind license key") do |l|
options[:license] = l
end
opts.on("-i", "--ip IPADDRESS", "IP address to look up") do |i|
options[:ip] = i
end
}.parse!
uri = URI::HTTP.build(:scheme => 'http',
:host => 'geoip.maxmind.com',
:path => '/e',
:query => URI.encode_www_form(:l => options[:license],
:i => options[:ip]))
response = Net::HTTP.get_response(uri)
unless response.is_a?(Net::HTTPSuccess)
abort "Request failed with status #{response.code}"
end
omni = Hash[fields.zip(response.body.encode('utf-8', 'iso-8859-1').parse_csv)]
if omni[:error]
abort "MaxMind returned an error code for the request: #{omni[:error]}"
else
puts
puts "MaxMind Omni data for #{options[:ip]}";
puts
omni.each { |key, val| printf " %-20s %s\n", key, val }
puts
end
第4个回答  2015-01-10
这个好像手机没有这个功能吧,最多就是通过软件定位....
android怎么获取用户所在地 csdn
三种方式进行定位,获取用户位置,分别是基于基站定位, 网络定位,GPS定位。1.基站定位(passive):这是基于网络基站进行定位的,定位的精确度在几十米到几千米不等,在城市中基站覆盖率比较高,推荐使用基站定位,如果是在郊区,基站相距较远,基站的覆盖没有城里好,定位的误差比较大。如果在郊区不推荐...

android怎么获取经度纬度
在Android应用程序中,可以使用LocationManager来获取移动设备所在的地理位置信息。看如下实例:新建android应用程序TestLocation。http:\/\/blog.csdn.net\/yyywyr\/article\/details\/39063181

cocos2d-x从网windows移植到android,我使用的是跨平台的BSDsocket不...
请参考#else 后的代码,获取本地ipbool getLocalIP(char *szLocalIP) { #ifdef WIN32 char name[255];\/\/定义用于存放获得的主机名的变量 struct hostent *hostinfo; if( gethostname ( name, sizeof(name)) == 0) { if((hostinfo = gethostbyname(name)) != NULL) { ...

android sqlite cursor怎么得到date类型 csdn
在android的sqlite中存取DATETIME类型的方法。创建表时:String sql="create table tb3(idINTEGER PRIMARY KEY,timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, weight DOUBLE)";timestamp字段缺省值是当前时间(基于GMT而不是local time)。这问题导致了记录的时间跟本地实际时间有几个小时的差距,费了我好...

android webView怎么得到当前地址
如有转载,请声明出处: 时之沙: http:\/\/blog.csdn.net\/t12x3456Android WebView常见问题解决方案汇总:就目前而言,如何应对版本的频繁更新呢,又如何灵活多变地展示我们的界面呢,这又涉及到了web app与native app之间孰优孰劣的争论. 于是乎,一种混合型的app诞生了,灵活多变的部分,如淘宝商城首页的活动页面,一...

android如何获取最顶层窗口 csdn
public static class TopActivityInfo { public String packageName = ""; public String topActivityName = ""; }private TopActivityInfo getTopActivityInfo() { ActivityManager manager = ((ActivityManager)GlobalConfig.getContext().getSystemService(Context.ACTIVITY_SERVICE)); TopA...

android微信分享的链接怎么启动app-CSDN论坛
1、eclipse编译使用的Custom keystore处, 修改为自己的keystore 路径 (非默认的debug keystore)2、在微信开放平台官网注册自己的应用,提交审核,注意 要填入自己的keystore 产生的 签名,(此签名获取方法:用 自己的keystore 签名自己的应用,装入手机,再安装 官网的 genSignature.apk,运行,输入自己...

android平台地图,如何实现如图所示功能?点击地图上的地点,弹出activity...
首先,你要获取到自己的数据列表,包括店名、坐标(经纬度)、序号、店面链接URL等。写一个类MarkerOverItem extends ItemizedOverlay<OverlayItem> 在createItem里通过坐标生成一个geoPoint对象,overlayItem = new OverlayItem(geoPoint, title, message).在draw(Canvas canvas, MapView mapView, boolean ...

Android开发 求教 手机扫描局域网内所有ip
如果是 java 的话,我写了一个类似此功能的博客,你可以借鉴一下 http:\/\/blog.csdn.net\/jspping\/article\/details\/64438515 这个是获取ip的,但是又是多用户向 group 发消息,收消息注册 group 的端口跟 ip 就行了 然后用户将自己的设备信息端口之类的相关消息通过你们内部定好的协议发送到 group ...

Android能够获取到唯一的设备ID吗
更具体地说,Settings.Secure.ANDROID_ID 是一串64位的编码(十六进制的字符串),是随机生成的设备的第一个引导,其记录着一个固定值,通过它可以知道设备的寿命(在设备恢复出厂设置后,该值可能会改变)。 ANDROID_ID也可视为作为唯一设备标识号的一个好选择。如要检索用于设备ID 的ANDROID_ID,请参...

相似回答