Giter Club home page Giter Club logo

Comments (4)

apsun avatar apsun commented on May 31, 2024

It does exactly what it says on the tin, if you return true the access is permitted, if you return false it's rejected. This applies even if you are calling it from within the app that owns the preferences; however you should not be doing that anyways, if you own the preferences then you can just directly use SharedPrefences to access them.

I'm not sure what you mean by getCallingPackage not being available; the docs say it was there since 1.0.

from remotepreferences.

rraallvv avatar rraallvv commented on May 31, 2024

Thanks for looking into this, I was able to give write access to the preferences owner via the SharedPreferences as you said, the problem is that I was trying to use RemotePreferences from a library that is meant to be used from both the preferences owner and also other apps. getCallingPacked was added to ContentProvider in API 19

from remotepreferences.

apsun avatar apsun commented on May 31, 2024

Ah my bad, I was looking at Activity.getCallingPackage. Honestly I have no idea; personally I would recommend against using getCallingPackage altogether. If you are just storing ordinary preferences (no passwords/tokens) there is probably nothing wrong with just letting anyone read them. If you have sensitive preferences but don't need to remotely access them, split your preferences into a private and a public file, and only pass the public one to the provider constructor.

If you really want to limit it to one app or you need write permissions, you might be able to use Binder.getCallingUid, which is available since API1.

from remotepreferences.

rraallvv avatar rraallvv commented on May 31, 2024

Thanks.

from remotepreferences.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.