# Android SDK 快速入门

通过这个快速简单的示例开始使用 Pushwoosh Android SDK

## 先决条件

要将 Pushwoosh Android SDK 集成到您的应用中，您需要满足以下条件：

<TranslatedFragment id="prerequisites-android" />

## 下载示例项目

从 GitHub 克隆示例项目：
```bash
git clone https://github.com/Pushwoosh/pushwoosh-android-sample
```

## 配置项目

1. 将您的 **google-services.json** 文件放置在 pushwoosh-demoapp/app 目录中。

2. 在您的 **build.gradle** (Module: app) 文件中，更新 `applicationId` 以匹配您的包名。

3. 在 **res/values/strings.xml** 中，将占位符值替换为您的具体信息：
  - `pushwoosh_app_id`：使用您的 Pushwoosh App Code。
  - `pushwoosh_api_token`：使用您的 [Pushwoosh Device API Token](/zh/developer/api-reference/api-access-token/#device-api-token)
```xml title="strings.xml"
<resources>
    <string name="app_name">demoapp</string>
    <string name="title_home">Actions</string>
    <string name="title_notifications">Settings</string>
    <string name="pushwoosh_app_id">_YOUR_PUSHWOOSH_APP_ID_</string>
    <string name="pushwoosh_api_token">_YOUR_PUSHWOOSH_DEVICE_API_TOKEN_</string>
</resources>
```

## 运行项目

1. 构建并运行项目。
2. 该应用将有两个标签页：“Actions” 和 “Settings”。导航到 **Settings** 标签页。
3. 点击 **Register for Pushes** 按钮。
4. 授予推送通知权限。设备将在 Pushwoosh 注册。

您应该会看到类似这样的日志条目：
```plaintext title="Logcat"
Log level: INFO
[RequestPermissionHelper] Requesting permissions
Pushwoosh SDK initialized successfully
HWID: __HWID_OF_YOUR_DEVICE__
APP_CODE: __YOUR_PUSHWOOSH_APP_ID__
PUSHWOOSH_SDK_VERSION: __PUSHWOOSH_SDK_VERSION_INSTALLED__
FIREBASE_PROJECT_ID: __YOUR_FIREBASE_PROJECT_ID__
PUSH_TOKEN:
User ID "__USER_ID_OF_THE_DEVICE__" successfully set

[NotificationManager] Registered for push notifications: __DEVICE_PUSH_TOKEN__
```

## 发送推送通知

返回 Pushwoosh Control Panel，并向您注册的设备[发送一条推送通知](/zh/product/messaging-channels/push-notifications/send-push-notifications/one-time-push)。

## 后续步骤
要了解更多信息，请参阅[基本集成指南](/zh/developer/pushwoosh-sdk/android-sdk/firebase-integration/integrate-pushwoosh-android-sdk/)