Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Alert option is set in the code but there is no Alert on the phone #155

Open
wangershuai opened this issue Aug 25, 2022 · 1 comment

Comments

@wangershuai
Copy link

With this setup, the card data in the phone changes, but there is no pop-up notification

  $options = [
                'key_id' => env('APPLE_KEY_ID'), // The Key ID obtained from Apple developer account
                'team_id' => env("APPLE_TEAM_ID"), // The Team ID obtained from Apple developer account
                'app_bundle_id' => env("PASS_TYPE_ID"), // The bundle ID for app obtained from Apple developer account
                'private_key_path' => base_path() . env("APPLE_APPLICATION_CREDENTIALS_P8"), // Path to private key
                'private_key_secret' => null // Private key secret
            ];

            $authProvider = AuthProvider\Token::create($options);

            $alert = Alert::create()->setTitle('Hello!');
            $alert = $alert->setBody('First push notification');

            $payload = Payload::create()->setAlert($alert);
            $payload->setSound('default');
            $payload = $payload->setCustomValue("balance", "new");

            // 更新的组
            $deviceTokens = [];
            $deviceTokens[] = $sPushToken;

            $notifications = [];
            foreach ($deviceTokens as $deviceToken) {
                $notifications[] = new Notification($payload, $deviceToken);
            }

            $client = new Client($authProvider, $production = true);
            $client->addNotifications($notifications);

            $responses = $client->push();
@Bekshakx
Copy link

@wangershuai have you solved this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants