10

Androidで実行しているアプリで、ウェブビューのみを使用してモバイルウェブアプリケーションを表示し、ある時点でデバイスのGPSを使用して位置を取得しています。

カスタムChromeWebClientなどがあり、省電力モードが有効になっているデバイスを除いて、適切に位置を取得しますか?とにかく、SDK / APIに、ユーザーがこれを有効にしているかどうかを判断し、それに応じてアドバイスできるようにすることはできますか?ドキュメントに何も見つからないので、試してみる価値はないと思いますが、

乾杯、

リー

4

1 に答える 1

6

After reeding the comments

In my experience Samsung, as well as HTC, is one of the manufacturers that modify Android OS in most unpredictable ways. They add new functions and modes, like 4G switching launcher widgets and "power saving mode". They modify permission requirements for documented SDK methods, i.e. to switch on bluetooth on a Samsung device your app needs to have and additional android.permission.BLUETOOTH permission, while stock Android only needs android.permission.BLUETOOTH_ADMIN. And there's more.

Long story short, as @RaghavSood pointed out, "power saving mode" is not an official AOSP feature and there are no ways to detect it via official SDK. There is a possible way how you can work around it though. I believe it is most likely that your app misbehaves in power saving mode because this mode turns off GPS. You can confirm that by configuring power saving mode in settings to disable GPS disabling(can't phrase this better, sorry) - first link from google with steps. Then test the app. Does it work? If yes, then you've rootcaused the problem and now your job is to let the user know that your app won't run without GPS. You can put some code into your app to detect if GPS service is enabled an show an alert dialog if it isn't. The code in your activity can look something like this:

LocationManager lm = getSystemService(Context.LOCATION_SERVICE);
if(!lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
    //Show a notification prompting user to switch on GPS.
}

You can be even more elaborate and make your app detect device manufacturer to show a custom message on all Samsung devices.

于 2013-03-05T08:19:04.577 に答える