Expo android应用程序,PushNotifications在独立apk中不起作用?

Expo android app, PushNotifications doesn#39;t work in standalone apk?(Expo android应用程序,PushNotifications在独立apk中不起作用?)
本文介绍了Expo android应用程序,PushNotifications在独立apk中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,当我通过 expo 客户端应用程序运行应用程序时,PushNotifications 有效.但是如果我正在构建一个独立的 .apk,我需要安装 expo 客户端,以便获取 pushtoken.而且,当 expo 客户端未打开时,我无法获得 pushtoken.所以我的客户需要安装 2 个应用程序.一个是我的,构建了独立的 .apk,另一个是 expo 客户端.这是繁琐的流程..

I am facing a problem, when I am running an app through expo client app, PushNotifications works. But if I am building a standalone .apk, I need to install expo client, in order to get pushtoken. And, when expo client is not turned on, I cannot get pushtoken. So my customer needs to install 2 apps. One is mine, built standalone .apk, and other is expo client. It is tedious flow..

推荐答案

我能够在我的项目中修复 expo 推送通知.这是我自己的错.问题是这样的,甚至文档也提供了解决方案:所以我用 Firebase 创建了一个帐户,然后我附加了新项目.然后我运行了这个命令:

I was able to fix expo push notifications in my project. It was my own fault. The problem was this, even documentation provides solution: So I created an account with Firebase, then I attached new project. Then I ran this command:

expo push:android:upload --api-key <Server key>

您可以从此部分获取服务器密钥:

You can get server key from this section:

它看起来像这样:

XXXSdasx665:APA91bFL2342342342342342342342RxDAUbCOP0IL32etVueLhnLtoFErsqHBhjW-SRPSZGdU18BBIltUx7Wm234234234sxdxzcasdSElRyTEdMR7vmLJHgVvbOGx-0-SWDasdzxzxzx

这帮助我解决了我遇到的问题.希望它也会对某人有所帮助.

This helped me to fix the issue I was having. Hopes it will help someone too.

这是一个 app.json 文件:

This is an app.json file:

{
  "expo": {
    "name": "workero",
    "slug": "workero",
    "privacy": "public",
    "sdkVersion": "36.0.0",
    "platforms": ["android"],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "package": "com.workero.apper",
      "googleServicesFile": "./google-services.json"
    }
  }
}

这篇关于Expo android应用程序,PushNotifications在独立apk中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)