Я пытался использовать checkCallingPermission из AppWidgetProvider, и хотя я добавил к
AndroidManifest.xml:
...
<permission android:permissionGroup="android.permission-group.PERSONAL_INFO"
android:description="@string/receiveUpdates" android:protectionLevel="normal"
android:label="@string/receiveStatusUpdates" android:name="my.prem.RCV_STATUS">
</permission>
<uses-permission android:name="my.prem.RCV_STATUS"/>
...
В моем виджете результат равен -1 (PackageManager.PERMISSION_DENIED).
public void onReceive(Context context, Intent intent) {
... // check that this is the Action I've been waiting for.
int result = context.checkCallingPermission(my.prem.RCV_STATUS);
....
}
Нажатие на виджет отправляет PendingIntent для запуска служб, выполняющих AsyncTask, postExecute AsyncTask отправляет ожидаемое мной намерение.
Спасибо.