简体   繁体   中英

How to connect android app to google cloud storage via JSON API

I have problem with connect my Android App to Google Cloud Storage. I want to connect via JSON API, i can't use google authorization for this.

I generated API key. In the Internet I found, that I should do this on manifest .xml:

<meta-data
            android:name="??????"
            android:value="MY_API_KEY" />

but I don't know, what I should put on:

android:name="??????"

Can You help me?

`"Meta-data contains a name-value pair for an item of additional, arbitrary data that can be supplied to the parent component"

A meta-data is made up of the following:

Android:name: A unique name for the item. To ensure that the name is unique, use a Java-style naming convention — for example, "com.example.project.activity.fred".

android:resource: A reference to a resource. The ID of the resource is the value assigned to the item. The ID can be retrieved from the meta-data Bundle by the Bundle.getInt() method.

Android:value: The value assigned to the item. The data types that can be assigned as values and the Bundle methods that components use to retrieve those values are listed in the following table: source .

You are supposed to use a unique name for the API-KEY as it is in your app.Take a look at these two examples:

<meta-data 
   android:name="my_api_key" 
   android:value="mykey123" /> 

<meta-data android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version" />

In the second example, @integer/google_play_services_version" gets the value from string.xml .

Simply put, name expects the name of the stuff you intend to use in the meta-data and value expects the value of that stuff.

Read this good explanation of how to use the Meta-data in the manifest.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM