akoscz / YouTubePlaylist

A sample Android application which demonstrates the use of the YouTube Data v3 API.
Apache License 2.0
153 stars 84 forks source link

the app is alwasy wrong. #4

Closed stickylabdev closed 9 years ago

stickylabdev commented 9 years ago

I have been change the Apikey.java but force close .

Maybe i have to change this code too ..

public class YouTubeActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.youtube_activity);

    if (ApiKey.YOUTUBE_API_KEY.startsWith("YOUR_API_KEY")) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this)

but when i change ..it still ERROR .till now ...so sad :(

akoscz commented 9 years ago

Can you be a bit more specific as to the problem your having?

Also, did you follow the instructions in the README.md? You MUST create an API Key for your application through Google Developer Console https://developers.google.com/youtube/registering_an_application When you register your application with the Google Developer Console you need to enable the YouTube Data API. Also, you need to register a Web Application NOT an Android application because the API key that this sample app uses is the "Browser Key".

stickylabdev commented 9 years ago

So i must use Oauth?

stickylabdev commented 9 years ago

Your application must have authorization credentials to be able to use the YouTube Data API. This document describes the different types of authorization credentials that the Google Developers Console supports. It also explains how to find or create authorization credentials for your project.

stickylabdev commented 9 years ago

Please what sould i change in the source code ..please ..and give me api key example ...

akoscz commented 9 years ago

Follow the instructions.

https://developers.google.com/youtube/registering_an_application

Create your project and select API services

  1. Go to the Google Developers Console. https://console.developers.google.com/
  2. Select a project, or create a new one.
  3. In the sidebar on the left, expand APIs & auth. Next, click APIs. In the list of APIs, make sure the status is ON for the YouTube Data API v3. In the sidebar on the left, select Credentials.
  4. The API supports two types of credentials. You need to use API Keys.

    API keys: A request that does not provide an OAuth 2.0 token must send an API key. The key identifies your project and provides API access, quota, and reports.

See the Creating API Keys section for information about creating an API key. https://developers.google.com/youtube/registering_an_application#Create_API_Keys

Creating API Keys

The API supports several types of API keys. If the key type that you need does not already exist, create an API key by selecting Create New Key and then selecting the appropriate key type. Then enter the additional data for that key type.

Browser keys <-- this is what you want to create

Create and use a browser key if your application runs on a client, such as a web browser. To prevent your key from being used on unauthorized sites, only allow referrals from domains you administer.

The YouTubePlaylist sample application uses the browser key. Copy and paste the browser key you generated into ApiKey.java

stickylabdev commented 9 years ago

:'( ..still force closed.

akoscz commented 9 years ago

Sorry, I don't know what else to tell you. Once you create the proper API Browser Key, then copy/paste it into ApiKey.java, recompile, launch app, it will work just fine.

stickylabdev commented 9 years ago

But ..i am not using grandle ..i am using .jar file ...its infuence to the app to be force close ...please you should try using .jar library .

stickylabdev commented 9 years ago

But this will not work if you using Jar Library

Minggu, 12 Juli 2015, Akoscz notifications@github.com menulis:

Sorry, I don't know what else to tell you. Once you create the proper API Browser Key, then copy/paste it into ApiKey.java, recompile, launch app, it will work just fine.

— Reply to this email directly or view it on GitHub.< https://ci4.googleusercontent.com/proxy/TXa_kbnHaBuCjx6h7RpVrTVznP63AVst-28aX5LTBYVm-yJyVvu-RJa17Z3YJh6jdMTwVoLvCUGmE-Nr5AKMULxLMB_9BcFJGuXNqVnjX_8RUypjchxeXSEQffDU7ofC_1pVjjtB14AlHAvO-l4QvwKBNtTT3A=s0-d-e1-ft#https://github.com/notifications/beacon/AMePYcp9A8bm2ehIezkXXyrMmZqAjlJIks5ocenKgaJpZM4FWzA0.gif