如果我通过USB安装它,我的应用程序工作正常,但如果我通过市场安装它,或者将其上传到任何地方并使用我的手机下载它我没有得到任何位置更新。
为什么会发生这种情况?
一些(加密的)Java:
package com.tripr;
public class MyWallpaperService extends WallpaperService{
<snip>
@Override
public Engine onCreateEngine() {
return new CubeEngine(this);
}
class CubeEngine extends Engine implements LocationListener{
private MyWallpaperService mws;
private LocationManager lm;
<snip>
CubeEngine(MyWallpaperService mymws) {
mws = mymws;
lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
requestLocationUpdates();
MyThread myThread = new MyThread(lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER));
myThread.start();
}
void requestLocationUpdates(){
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000*30, 10, this);
}
void removeUpdates(){
lm.removeUpdates(this);
}
@Override
public void onLocationChanged(Location location) {
MyThread myThread = new MyThread(location);
myThread.start();
}
<snip>
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tripr"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.software.live_wallpaper" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<service android:name=".MyWallpaperService"
android:label="@string/app_name"
android:icon="@drawable/icon"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data android:name="android.service.wallpaper"
android:resource="@xml/livewallpaper" />
</service>
</application>
</manifest>
答案 0 :(得分:0)
索里,
现在我也没有使用调试密钥获取位置更新,因此该错误位于其他地方......