Closed GoogleCodeExporter closed 8 years ago
Hi,
For legal reasons, NPR can't give away the website level key needed to pull all
content - including rights restricted stuff - out of the API. All stories, etc
are called using this key, hence, why the app won't build without it. However,
you can fix this my creating a txt file and including your own generated key.
Go to: http://www.npr.org/api/queryGenerator.php
Request a key
Create a .txt file in res>raw and paste your public key into the text file
(NOTE: do not paste a query in here, just the key)
Name it api_key.txt
Try that and it should build. There are is one other omission from the open
source code which is some priority tracking code. I don't believe missing that
file breaks the build. You shouldn't notice a huge difference between the
website level key the app uses and the public one available. The main change is
music content.
Hope this helps!
Original comment by jpenn...@gmail.com
on 4 Sep 2010 at 5:50
jpennyco,
Thank you for your rapid update. I propose adding a comment to the source code
that indicates how to fix the build error or adding a README file that
indicates such.
In the spirit of open source and the community helping to fix potential
security holes:
One trick I tried (and it worked) was to download the NPR APK file from the
downloads section of this site. Changed .apk to .zip and got the file out of
the res/raw/api_key.txt. I dropped that into the project and it worked just
fine.
I am not sure how to protect against this but if it is not allowed it needs
resolved.
Original comment by yepher.mail@gmail.com
on 5 Sep 2010 at 1:27
Replying to yepher.mail.
Extracting the api_key.txt file from the production "NPR News.apk" file and
putting it in the Eclipse development environment does allow you to build the
project without errors, and run the app in the emulator, but you're not able to
listen to any of the audio content, including streaming in stations, in the
Android emulator.
Installing the production "NPR News.apk" file into the emulator via the 'adb
install' command, then running the app from the emulator, does allow you to
hear the audio content.
Original comment by adrian.o...@gmail.com
on 6 Sep 2010 at 7:09
Adrian,
Thank you for the response. I guess it is fine than?
This is the key I was talking about: "MDA0MDY0MTU3MDEyNTM2MjkwNzc1NDk0Nw010"
which I got from this link
"http://code.google.com/p/npr-android-app/downloads/detail?name=NPR%20News.apk&c
an=2&q=" I suppose that is not the production version?
For what it is worth, the key above I am able to listen to the audio on the
Emulator no problem.
Original comment by yepher.mail@gmail.com
on 6 Sep 2010 at 4:40
Hmm...
Interesting. I will check this with our documentation at NPR tomorrow when I go
back after the holiday weekend. Just to clarify, yepher, the key you are
talking about is the one you extracted from the apk file?
I agree with your comments about adding some hint to explain why the api_key
file is missing, either in the code itself or in some documentation somewhere.
Perhaps, a wiki page would help? Submissions welcome :)
Thanks for the heads up on this.
Original comment by jpenn...@gmail.com
on 6 Sep 2010 at 6:13
Original comment by jpenn...@gmail.com
on 6 Sep 2010 at 6:13
JpennyCo,
Sorry this bug has taken on two discrete issues. I can file another bug if
needed. One for the build problem which was answered quite well by you above,
and the second is a security/infringement issue which this thread seems to be
addressing at this point.
Yes, the key I pasted above is from the .apk file found in the download
sections on this site. I just renamed the .apk file to .zip and found the key
file in the "raw" directory (before you had told me about generating my own
key).
I am happy to create the wiki page if you wish (I would probably paste your
response from above). I don't think I am the best person for this job but I am
happy to start the page.
I would suggest either:
- A comment in the code where the compile error is that points to the to be created Wiki page.
or
- I personally like a README or a build.info in the root directory that has this information. That is the first place I look in projects like these.
Original comment by yepher.mail@gmail.com
on 6 Sep 2010 at 6:44
If you wanna give the wiki page a crack, that'd great. Perhaps, you can
include some basic set up tips for eclipse - plug ins, etc - if you have
knowledge of that. It is always good to have someone who's actually
experienced as a new user of the code to explain what makes sense and what
doesn't.
I've also thought of another discrepancy you might notice. If you look under
the manifest file labeled 'AndroidManifest.xml' you will see the version number
and the code number don't match the current iteration. This is another file I
update manually before pushing the file to the Android Market.
As to a seperate bug, I will look into this security issue a bit more and see
what our tech team suggests here at NPR. Until then, let's just not broadcast
it. Would you mind editing/deleting your comment which posts the actual key
until we look at this more?
Are you looking to contribute to the project or just using it for your own
purposes? If you want to be part of the team, please sign up for the mailing
list if you haven't already: http://groups.google.com/group/npr-android We are
working on a major UI/feature overhaul at the moment for a 2.0 release in the
near future. Would love to have more help.
Thanks.
Original comment by jpenn...@gmail.com
on 9 Sep 2010 at 4:12
The app already has code to handle if the API key is empty, it's just not able
to handle a missing file because the compile step requires it.
We can fix the code easily to produce the dialog by adding an empty api_key
file. There's one minor change needed in the app to get it to launch so it can
show the dialog. Also, adding the above instructions to the dialog would be
helpful as well.
Here's a patch that addresses these.
http://codereview.appspot.com/2232042/
Original comment by jeremy.w...@gmail.com
on 16 Sep 2010 at 7:43
Attachments:
The original issue for this bug report (not being able to build the app
directly from source) his fixed in r106.
Original comment by jeremy.w...@gmail.com
on 16 Sep 2010 at 9:16
Original issue reported on code.google.com by
yepher.mail@gmail.com
on 4 Sep 2010 at 4:48