From: Kostya Vasilyev <kmans...@gmail.com>
Date: Sat, 4 Aug 2012 19:20:51 +0400
Local: Sat, Aug 4 2012 11:20 am
Subject: Re: [android-developers] SecurityException in RemoteViewsService?
I've run into this exact issue before.
My fix was to add Binder.clearCallingIdentity() in my RemoteViewsService
Now we're back from the launcher's identity to the identity of the app's
It fit into the code structure like this:
public static class MyWidgetService extends RemoteViewsService {
}
private static class MyWidgetRemoteViewsFactory implements
RemoteViewsService.RemoteViewsFactory { ... @Override public void onDataSetChanged() { MyLog.i(TAG, "onDataSetChanged"); * // Revert back to our process' identity so we can work with our content
} finally {
listCursor.close();
}
} finally {
} * // Restore the identity - not sure if it's needed since we're going to return right here, but* * // it just *seems* cleaner* * Binder.restoreCallingIdentity(identityToken);* } }
The only place where MyWidgetRemoteViewsFactory uses the content provider
is its onDataSetChanged() -- contrary to proimises made by the documentation, I've decided to play it safe and avoid keeping an open cursor during the lifetime of the factory. If your factory keeps an open cursor outside of one method's scope, you may
-- K
2012/8/4 NickL <nicklongi...@gmail.com>
> Error accessing content provider in RemoteViewService
> Hi,
> I'm trying to build a home screen widget for my app and I am using
> --
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||