davide-scalzo / react-native-mixpanel

A React Native wrapper for Mixpanel tracking
MIT License
455 stars 195 forks source link

getPushRegistrationId #237

Open bpfeiffer187 opened 4 years ago

bpfeiffer187 commented 4 years ago

Hey Everyone,

putting in notifications, and setting up android it wants to use getPushRegistrationId(), this function takes a call back. I am struggling as to what function to call within? is there a specific FCM fucntion that returns a value. Any help clarify from the docs would be helpful.

0hio-creator commented 4 years ago

returns a promise could either in async function use await i.e

let token = await getPushRegistrationId()

Keep in mind I believe this function is looking for fcm token on Mixpanel. So unless you have retrieved it elsewhere and then setPushRegistrationId(token) would not expect a value to be returned

bpfeiffer187 commented 4 years ago

ok thanks so i guess my real question then becomes what value does it expect in the setRegID() for the token. is it just the string from server token within the firebase cloud portal? the same one we paste into mixpanel to tie them together.

that to me doesnt seem specific enough to user.

0hio-creator commented 4 years ago

No its not the server token. For android you need an FCM token for IOS you need an apns token

The token is specific to the device. You are associating the device with the user in mixpanel so that when mixpanel sends a notification it reaches the device.

IOS example with react native firebase. https://github.com/davodesign84/react-native-mixpanel/issues/234

bpfeiffer187 commented 4 years ago

cool thanks, the thing i am stuggling with for android is what is the function i have to use to return the FCM Token.

like is there extra stuff that has been done on the android side to get this going.

if you wouldnt mind reaching out to me bpfeiffer55@gmail.com i could really use some help with this if you have time. thanks much.