question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to get push token - no error code

See original GitHub issue

Hi

I’m calling Push.getToken method from Flutter and I’m not receiving the token (also not seeing a platform level error).

The log I’m seeing is as follows:

I/HMSSDK_BaseAdapter(12684): in baseRequest + uri is :push.gettoken, transactionId is : some-long-id
I/HMSSDK_PendingResultImpl(12684): init uri:push.gettoken
I/HMSSDK_PendingResultImpl(12684): setResultCallback
I/HMSSDK_PendingResultImpl(12684): setResult:0
I/HMSSDK_BaseAdapter(12684): baseCallBack.onComplete
I/HMSSDK_HmsClient(12684): receive msg status_code:0, error_code0, api_name:push.gettoken, app_id:my-id|, pkg_name:my-package, session_id:*, transaction_id:some-long-id, resolution:null

I have followed the AG connect steps to ensure that push is enabled and I’ve added the SHA-256 signature. I’ve also done the gradle setup - in fact maps integration works with the current gradle setup.

At the moment I’m unable to obtain the push to the server so we can send targetted pushes. Please assist.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aktugcommented, Aug 19, 2020

Thank you for PR, we’ll look at your changes but there are different development processes in our team so at this time we can’t merge your PR directly, thank you @KholofeloMoyaba for your contribution 🍻

0reactions
KholofeloMoyabacommented, Aug 19, 2020

Hi again @aktug

Thanks for your response. Yes, I think the issue which is problematic on my side is just the communication back to flutter via the MethodChannel.Result. I don’t have an issue with anything EMUI related.

I’ve already made and tested a fix which would make it much easier for other Flutter developers. I don’t have the rights to make a PR directly against this repo, so I made a fork. Please see below the PR from the forked repo: https://github.com/HMS-Core/hms-flutter-plugin/pull/7

I have already tested this on a flutter app running on a Huawei device and it works, while still respecting the TOKEN_CHANNEL. So nothing is lost.

Just to give you an example of how it becomes an issue on the flutter side using the current version:

  1. You basically have a request to getToken and you won’t know within the same context if you got a reply or not.
  2. You then have to listen to the TOKEN_CHANNEL in another part of the code and put it in some sort of persistent storage.
  3. Finally, in the original getToken you need to add artificial delay and check the persistent storage to see if you have a result or not.

So it’s possible, but it becomes very hard to have an on-demand implementation of getting a token on Flutter. The PR I supplied fixes this while keeping the TOKEN_CHANNEL intact.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to get a push token · Issue #19855 · expo/expo - GitHub
[Error: Error encountered while fetching Expo token, expected an OK response, received: 503 (body: "no healthy upstream"). Everything worked ...
Read more >
push notification problem | Apple Developer Forums
The error is "Notification error: APN invalid token" when i install the app from App Store, but works fine when I install from...
Read more >
Unable to get push token. Getting error: 907135004 ...
This error code suggests that AIDL has a call timed out. Please try the steps as below: Check whether your phone has internet...
Read more >
Push Notifications Troubleshooting & FAQ
The ExpoPushToken will never "expire" but if one of your users uninstalls the app, you'll receive a DeviceNotRegistered error back from Expo's servers,...
Read more >
Error Messages for Push Notifications - Salesforce Help
If you get an error message while sending a push notification from the Send Test Notification page, check the following table for suggestions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found