jpush / jpush/jpush-phonegap-plugin

android: 调用 getRegistrationID 无法获取值

Open
#415 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
922
Forks
350
PR merge metrics
No merged PRs in 30d

Description

WARNING: 如果不按照这个表格,我们将无法帮助你,并将忽略你的问题。

你的运行环境

  • 插件版本:
  • 平台(Android / iOS): Andoird
  • Cordova version (cordova -v): 9.0.0 (cordova-lib@9.0.1)
  • Cordova platform version (cordova platform ls):
Installed platforms:
  android 8.0.0
Available platforms: 
  browser ^6.0.0
  electron ^1.0.0
  ios ^5.0.0
  osx ^5.0.0
  windows ^7.0.0
  • Ionic Version (if using Ionic): 5.2.5

期望效果

获取到 getRegistrationID

实际效果

始终无法获取。

重现步骤

以下是获取 getRegistrationID 的动作:

const _get = () => this.jpush.getRegistrationID().then(_handle);
const _handle = (gid: string) => {
    if (!gid) {
        setTimeout(_get, 1000 * 3);
		return ;
    }
	// Http request
};

_get();

尝试以下几种方式,依然无法获取:

  • 手机:华为P20 Pro
  • 正确设置极光开发者服务的应用包名
  • 调用 getConnectionState 返回 0 表明初始化并且连接成功
  • 尝试试移除APP,然后重新安装
  • 打开 Debug 但未发现任何跟 JIGUANG 相关日志,一次完整运行且未获取到值,所产生的日志为:
2019-08-27 03:00:16.123 9472-9711/com.xxx.xx D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:init
2019-08-27 03:00:43.841 9472-9472/com.xxx.xx D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:change_foreground

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Android implementation and call path for getRegistrationID, then compare its initialization behavior with getConnectionState. Reproduce using Cordova 9.0.0, Android platform 8.0.0, and the reported Huawei P20 Pro setup; the issue is done when the cause of the empty value is identified and the registration ID can be retrieved reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.