我目前正在尝试Genymotion和男孩,它比ADT模拟器快得多.
但我需要安装Google Play才能将一些应用下载到其中.我该怎么做呢?
android android-virtual-device google-play-services genymotion
我现在有点迷失了.我正在使用Google地图实现Android应用程序.
为了使它工作,我遵循了一些非常有效的教程.但是我坚持这个":

要修复,这个问题我在这里或这里找到了一些技巧,告诉你要解决这个问题,你必须为模拟器采取特殊配置,这是我的:

并在模拟器上安装一些.apk.

并且应该完成魔法并且应该出现地图,这不是我的情况.
我检查了我的附加功能是否安装得很好:

这是我的AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mypack"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="16"/>
<permission android:name="mypack.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="mypack.permission.MAPS_receive"/>
<!-- Permission pour utiliser la connexion internet -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Permission permettant de vérifier l'état de la connexion -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permission pour stocker des données en cache de la map -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application android:label="@string/app_name" …Run Code Online (Sandbox Code Playgroud) android google-maps android-emulator google-play google-play-services
我只在使用模拟器时遇到了一个奇怪的错误.我发现一个问题在9个月前有同样的问题,根本没有答案......
我正在使用谷歌播放服务位置来获取我的应用程序中的位置,我确定我的清单权限,一切都在我的手机上完美运行,只在使用模拟器时出现问题,我在我的iMac上尝试了不同的模拟器Windows机器.
我怀疑仿真器不支持这个基本功能!
这是我的清单代码:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.orderme.ordermeandroid" >
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Run Code Online (Sandbox Code Playgroud)
这里是异常触发的地方:
LocationRequest mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(10000);
mLocationRequest.setFastestInterval(5000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient,mLocationRequest,this);
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
08-26 14:01:19.699 10157-10157/com.orderme.ordermeandroid E/AndroidRuntime? FATAL EXCEPTION: main
Process: com.orderme.ordermeandroid, PID: 10157
java.lang.SecurityException: Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations.
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at com.google.android.gms.location.internal.zzg$zza$zza.zza(Unknown Source)
at com.google.android.gms.location.internal.zzi.zza(Unknown Source)
at com.google.android.gms.location.internal.zzj.zza(Unknown Source)
at com.google.android.gms.location.internal.zzd$1.zza(Unknown Source)
at com.google.android.gms.location.internal.zzd$1.zza(Unknown Source)
at com.google.android.gms.common.api.zzc$zza.zzb(Unknown Source)
at com.google.android.gms.common.api.zzf.zza(Unknown Source)
at com.google.android.gms.common.api.zzf.zzb(Unknown Source)
at com.google.android.gms.common.api.zzi.zzb(Unknown Source) …Run Code Online (Sandbox Code Playgroud) 如何将位置更新直接发送到Intent Service?以下方法不起作用.调用OnConnected函数,但从未在服务中接收到intent:
...
private PendingIntent getLocationPendingIntent(boolean shouldCreate) {
Intent broadcast = new Intent(m_context,LocationUpdateService.class);
int flags = shouldCreate ? 0 : PendingIntent.FLAG_NO_CREATE;
return PendingIntent.getService(m_context, 0, broadcast, flags);
}
@Override
public void onConnected(Bundle arg0) {
PendingIntent locationPendingIntent = getLocationPendingIntent(true);
LocationRequest locationRequest = new LocationRequest();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(LOCATION_UPDATE_INTERVAL);
locationRequest.setFastestInterval(LOCATION_FASTEST_UPDATE_INTERVAL);
LocationServices.FusedLocationApi.requestLocationUpdates(m_googleApiClient, locationRequest,locationPendingIntent);
}
...
Run Code Online (Sandbox Code Playgroud)
意向服务:
import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
public class LocationUpdateService extends IntentService {
public LocationUpdateService() {
super(LocationUpdateService.class.getName());
}
@Override
public int onStartCommand(Intent intent, int flags, int startID) {
super.onStartCommand(intent, flags, startID); …Run Code Online (Sandbox Code Playgroud) 我正在使用react-native构建我的第一个Android应用程序.我想要做的是显示我当前的位置.但它似乎不适用于我的模拟器.相反,我在控制台中收到" 位置请求超时 "错误.以下是我的idex.android.js文件中的代码示例:
initGeoloc() {
navigator.geolocation.getCurrentPosition(
(position) => {
console.log(JSON.stringify(position));
}
);
}
render() {
this.initGeoloc();
... some more code and the view
Run Code Online (Sandbox Code Playgroud)
代码非常简单,所以我不认为错误来自这里.我在AndroidManifest.xml文件中添加了这些权限(ACCESS_FINE_LOCATION,ACCESS_COARSE_LOCATION):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<uses-library android:name="com.google.android.maps" />
<meta-data android:name="com.google.android.geo.API_KEY" android:value="mykey"/>
</application>
Run Code Online (Sandbox Code Playgroud)
我也没有看到任何错误,所以我认为问题来自Android模拟器.我使用Android虚拟设备管理器创建了Nexus 5,Google API(Google Inc.) - API Level 23虚拟设备.地理定位在设备上激活,但我没有在开发工具或配置中看到任何地理定位工具.所以可能错误来自这里.虚拟设备不会返回任何位置.
我怎样才能解决这个问题 ?
我的应用适用于Google Apis 17.我想在启动模拟器后设置gps位置.
我尝试按照如何模拟-ps-location-in-the-android-emulator.
1.获取模拟器的序列号.
>adb devices
emulator-5554
Run Code Online (Sandbox Code Playgroud)
第二轮
adb -s emulator-5554 emu geo fix 121.4961236714487 31.24010934431376
Run Code Online (Sandbox Code Playgroud)
没有警告和错误.我在windows7上编程.
它不起作用.但是当我在eclipse(ADT22.6)中手动发送gps信息时,它可以工作.我的应用可以正确找到位置.eclipse做了什么?如何使adb命令工作?谢谢
我正在尝试使用Android Studio模拟器(Nexus 5)将页面加载到Android应用程序webview中.但是,页面加载不正确并且卡在加载屏幕上.该页面确实需要GeoLocation权限,但我已经启用了它们.
下面是我的代码和应用程序的XML.
MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webview;
setContentView(R.layout.activity_main);
webview = (WebView)findViewById(R.id.help_webview);
//webview use to call own site
webview.setWebViewClient(new WebViewClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setAllowContentAccess(true);
webview.getSettings().setAllowFileAccess(true);
webview.getSettings().setAppCacheEnabled(true);
webview.getSettings().setAllowUniversalAccessFromFileURLs(true);
webview.getSettings().setAllowContentAccess(true);
webview.getSettings().setGeolocationEnabled(true);
webview.getSettings().setDatabaseEnabled(true);
webview.setWebChromeClient(new WebChromeClient() {
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
// callback.invoke(String origin, boolean allow, boolean remember);
callback.invoke(origin, true, false);
}
});
webview.loadUrl("https://lit-citadel-6989.herokuapp.com");
}
Run Code Online (Sandbox Code Playgroud)
activity_main.xml中
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/help_webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:largeHeap="true" />
Run Code Online (Sandbox Code Playgroud)
AndroidManifest.xml中
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example.example" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission …Run Code Online (Sandbox Code Playgroud) 我需要知道如何模仿broadcastreceiver.
我有以下代码,但我不知道如何实际看到它何时接收广播.
public class LocationBroadcastReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent) {
Bundle b = intent.getExtras();
Location loc = (Location)b.get(android.location.LocationManager.KEY_LOCATION_CHANGED);
Toast.makeText(context, loc.toString(), Toast.LENGTH_SHORT).show();
Log.d("com.dennis.test","LOCATION: " + loc.toString());
}
}
Run Code Online (Sandbox Code Playgroud)
在我的清单中,我有以下内容:
<receiver android:name="com.dennis.test.LocationBroadcastReceiver">
<intent-filter>
<action android:name="android.location.LocationManager.KEY_LOCATION_CHANGED" />
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud) 我试图让 GPS 位置在 Android 下为我的应用程序工作没有成功。我想知道我可能做错了什么。到目前为止,我尝试了以下方法:
以及许多其他人,但都是徒劳的。
考虑到上述所有解决方案都适用于某些人或其他人,我将使用此解决方案进行调试:
package my.namespace;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
public class HomeActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener ll = new mylocationlistener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);
}
private class mylocationlistener implements LocationListener {
public void onLocationChanged(Location location) {
if (location != null) {
Log.d("LOCATION CHANGED", location.getLatitude() …Run Code Online (Sandbox Code Playgroud) 有没有办法给我的Genymotion机器人模拟器一个虚假的位置,例如美国,所以我可以测试移动广告和其他一些东西?
android ×10
genymotion ×2
geolocation ×2
adb ×1
eclipse ×1
emulation ×1
google-maps ×1
google-play ×1
gps ×1
java ×1
location ×1
react-native ×1
webview ×1
xml ×1