每次收到推送通知时,Ionic 2 应用程序都会停止
Ionic 2 app stops everytime it received a push notification
应用程序正在获取注册号,但是当它收到推送通知时,应用程序停止并给出以下错误:
Unfortunately "APP NAME" has stopped
在 android
我正在使用 phonegap-plugin-push => https://ionicframework.com/docs/native/push/
我已经在appName/platforms/android/
里面添加了google-services.json
这是我的 build.gradle
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.google.android.gms:play-services-maps:11.+"
compile "com.google.android.gms:play-services-location:11.+"
compile "com.stripe:stripe-android:4.1.2"
compile "com.android.support:support-v13:25.1.0"
compile "me.leolin:ShortcutBadger:1.1.17@aar"
compile "com.google.firebase:firebase-messaging:11.0.1"
}
这是我的 AndroidManifest.xml
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:exported="true" android:name="com.adobe.phonegap.push.PushHandlerActivity" android:permission="${applicationId}.permission.PushHandlerActivity" />
<receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" />
<receiver android:name="com.adobe.phonegap.push.PushDismissedHandler" />
<service android:name="com.adobe.phonegap.push.FCMService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
这里有人有同样经历吗?
我遇到了同样的问题,我使用的是 ionic 1。我编辑了我的 com.android.gms
版本以匹配 platforms/android/project.properties
文件中的 firebase-messaging 版本。
cordova.system.library.1=com.google.android.gms:play-services-location:11.+
cordova.system.library.6=com.google.firebase:firebase-messaging:11.+
到
cordova.system.library.1=com.google.android.gms:play-services-location:11.0.1
cordova.system.library.6=com.google.firebase:firebase-messaging:11.0.1
它现在按预期工作。
应用程序正在获取注册号,但是当它收到推送通知时,应用程序停止并给出以下错误:
Unfortunately "APP NAME" has stopped
在 android
我正在使用 phonegap-plugin-push => https://ionicframework.com/docs/native/push/
我已经在appName/platforms/android/
里面添加了google-services.json
这是我的 build.gradle
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.google.android.gms:play-services-maps:11.+"
compile "com.google.android.gms:play-services-location:11.+"
compile "com.stripe:stripe-android:4.1.2"
compile "com.android.support:support-v13:25.1.0"
compile "me.leolin:ShortcutBadger:1.1.17@aar"
compile "com.google.firebase:firebase-messaging:11.0.1"
}
这是我的 AndroidManifest.xml
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<activity android:exported="true" android:name="com.adobe.phonegap.push.PushHandlerActivity" android:permission="${applicationId}.permission.PushHandlerActivity" />
<receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" />
<receiver android:name="com.adobe.phonegap.push.PushDismissedHandler" />
<service android:name="com.adobe.phonegap.push.FCMService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
这里有人有同样经历吗?
我遇到了同样的问题,我使用的是 ionic 1。我编辑了我的 com.android.gms
版本以匹配 platforms/android/project.properties
文件中的 firebase-messaging 版本。
cordova.system.library.1=com.google.android.gms:play-services-location:11.+
cordova.system.library.6=com.google.firebase:firebase-messaging:11.+
到
cordova.system.library.1=com.google.android.gms:play-services-location:11.0.1
cordova.system.library.6=com.google.firebase:firebase-messaging:11.0.1
它现在按预期工作。