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

Trouble with additional parameters #66

Open
yaroslavsnisarua opened this issue Jun 8, 2017 · 2 comments
Open

Trouble with additional parameters #66

yaroslavsnisarua opened this issue Jun 8, 2017 · 2 comments

Comments

@yaroslavsnisarua
Copy link

yaroslavsnisarua commented Jun 8, 2017

Hello! First of all, thank you very much for great lib! Im using it on laravel 5.1)
In testing i have a same problem.

        $optionBuilder = new OptionsBuilder();
        $optionBuilder->setTimeToLive(30);

        $notificationBuilder = new PayloadNotificationBuilder('Auth');
        $notificationBuilder->setBody('Auth request...')
            ->setSound('default');

        $dataBuilder = new PayloadDataBuilder();
        $dataBuilder->addData(['a_data'=>[
            'mode'=>'auth',
            'private_key'=>'12345678901234567890123456789012'
        ]
]);

        $option = $optionBuilder->build();
        $notification = $notificationBuilder->build();
        $data = $dataBuilder->build();

        $token = '...';

        $downstreamResponse = FCM::sendTo($token, $option, $notification, $data);

and on Android i receive:

{a_data={“mode”:“auth”,“private_key”:“MXaFORX1dKZpXMCaiLl5uNo74yOqOTJW”}}

thats Ok! I can use a_data as json/object...

BUT on iOS i have a problem!

Push notification received: {
    “a_data” = “{\“mode\“:\“auth\“,\“private_key\“:\“TpbgLUn1Zq6WwREJxy3yGvgjEeaun75z\“}”;
    aps =     {
        alert =         {
            body = “Auth request...“;
            title = Auth;
        };
        sound = default;
    };
    “gcm.message_id” = “0:1496937050152314%939d13c6939d13c6";
}

a_data variable have string type, i can not use it.

Can you explain, how can i use sub-array in $dataBuilder->addData for iOS json/object type?

@brozot
Copy link
Owner

brozot commented Jul 28, 2017

Hi,

Your question need that I investigate a lot, I will try to find a solution and I will come back to you

Best Regards

@himalayaahuja
Copy link

anything on this..? facing the same issue.. on laravel 5.8

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

No branches or pull requests

3 participants