App stop working after firebase push notification on Ionic 3

Asked

Viewed 335 times

2

I’m trying to make a push notification using the cloudSettings with firebase, but when I send a message the app stops working and the following message appears:

inserir a descrição da imagem aqui

app.modulets.:

const cloudSettings: CloudSettings = {
  'core': {
    'app_id': 'APP_ID',
  },
  'push': {
    'sender_id': 'SENDER_ID',
    'pluginConfig': {
      'ios': {
        'badge': true,
        'sound': true
      },
      'android': {
        'iconColor': '#343434'
      }
    }
  }
};
...
imports: [
    BrowserModule,
    HttpModule,
    CloudModule.forRoot(cloudSettings)
]
...

app.componentts.:

....
initialize(){
 this.registerDeviceToken();
 this.handlerNotifications();
}

registerDeviceToken() {
    this.push.register().then((t: PushToken) => {
      return this.push.saveToken(t);
    }).then((t: PushToken) => {
      console.log('Token saved: ', t.token);
    });
  }

handlerNotifications() {
    this.push.rx.notification()
      .subscribe((msg) => {
        alert(msg.title + ': ' + msg.text);
     });
}

In my package.json a lib is defined as follows:

"phonegap-plugin-push": {
                "SENDER_ID": "SENDER_ID",
                "variables": "[object Object]"
}

And in config.xml:

<plugin name="phonegap-plugin-push" spec="^2.0.0">
        <variable name="SENDER_ID" value="SENDER_ID" />
        <variable name="variables" value="[object Object]" />
</plugin>

Ionic info:

local Packages:

@ionic/app-scripts : 2.0.1
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.5.0

System:

Android SDK Tools : 26.0.2
Node              : v6.10.3
OS                : Linux 3.13
npm               : 3.10.10

Error log:

09-06 15:09:51.634 2829 22829 I Activitymanager: Start proc 19365:br.com.app/u0a138 for Activity br.com.app/. Mainactivity 09-06 15:09:51.675 19365 19365 W System : Classloader referenced Unknown path: /data/app/br.com.app-1/lib/Arm 09-06 15:09:51.709 19365 19365 I FA : adb shell setprop debug.firebase.Analytics.app br.com.app 09-06 15:09:52.024 637 637 D Sfperftracer: layers: (5:8) (Statusbar (0xa987ec00): 20:31344) (com.android.systemui.Imagewallpaper (0xa9d49400): 20:20506) (Sprite (0xa987b000): 0:34)* (Dimlayercontroller/Stack=0 (0xa9d4a800): 0:1353)* (Animation background stackId=1 (0xa987d800): 0:112)* (com.google.android.googlequicksearchbox/com.google.android.launcher.GEL (0xa9d4bc00): 20:298) (Navigationbar (0xa987c400): 20:46) (Starting br.com.app (0xa986bc00): 20:24) 09-06 15:09:52.164 2829 4059 I Windowmanager: Switching to real app window: Window{da0e6a U0 br.com.app/br.com.app.Mainactivity} 09-06 15:09:52.222 2829 2881 I Launchcheckinhandler: Displayed br.com.app/. Mainactivity,cp,ca,600 09-06 15:09:52.223 2829 2881 I Activitymanager: Displayed br.com.app/. Mainactivity: +600ms 09-06 15:09:54.942 637 637 D Sfperftracer: layers: (5:11) (Statusbar (0xa987ec00): 9:31376) (com.android.systemui.Imagewallpaper (0xa9d49400): 9:20538)* (Sprite (0xa987b000): 0:34)* (Dimlayercontroller/Stack=0 (0xa9d4a800): 0:1353)* (Animation background stackId=1 (0xa987d800): 0:112)* (com.google.android.googlequicksearchbox/com.google.android.launcher.GEL (0xa9d4bc00): 0:309)- (Navigationbar (0xa987c400): 9:78) (Starting br.com.app (0xa986bc00): 0:45)- (br.com.app/br.com.app.Mainactivity (0xa9d48000): 10:30) (br.com.app/br.com.app.Mainactivity (0xa81d5000): 125:163) (br.com.app/br.com.app.Mainactivity (0xa81d6400): 28:45) 09-06 15:10:11.599 19365 19365 And Androidruntime: Process: br.com.app, PID: 19365 09-06 15:10:11.599 19365 19365 And Androidruntime: java.lang.Nosuchmethooverthrow: No Static method zzJU()Lcom/google/firebase/iid/zzq; in class Lcom/google/firebase/iid/zzq; or its super classes (declaration of 'com.google.firebase.iid.zzq' appears in /data/app/br.com.app-1/base.apk) 09-06 15:10:11.601 2829 3751 W Activitymanager: Force Finishing Activity br.com.app/. Mainactivity 09-06 15:10:12.110 2829 2848 W Activitymanager: Activity pause timeout for Activityrecord{6c0658b U0 br.com.app/. Mainactivity T98 f} 09-06 15:10:13.786 2829 3751 W Activitymanager: Force Finishing Activity br.com.app/. Mainactivity 09-06 15:10:13.797 637 637 D Sfperftracer: layers: (6:11) (Statusbar (0xa987ec00): 0:31453) (com.android.systemui.Imagewallpaper (0xa9d49400): 0:20613) (Sprite (0xa987b000): 0:34)* (Dimlayercontroller/Stack=0 (0xa9d4a800): 0:1362) (Animation background stackId=1 (0xa987d800): 0:112)* (Navigationbar (0xa987c400): 0:165) (br.com.app/br.com.app.Mainactivity (0xa9d48000): 0:39)- (br.com.app/br.com.app.Mainactivity (0xa81d5000): 0:165)- (br.com.app/br.com.app.Mainactivity (0xa81d6400): 0:122)* (Application Error: br.com.app (0xa9d48000): 3:70) (com.google.android.googlequicksearchbox/com.google.android.launcher.GEL (0xa81d5000): 0:31) 09-06 15:10:13.809 2829 3751 I Activitymanager: Killing 19365:br.com.app/u0a138 (adj 0): crash

1 answer

2


The problem was happening by conflict between libs. A lib phonegap-plugin-push was conflicting with another lib cordova-plugin-request-location-accuracy.

In the plugin.xml file that is generated within the plugins/your package folder I saw that the Location plugin looked like this:

 <framework src="com.google.android.gms:play-services-location:11.+" />

The solution was to change this line, thus:

<framework src="com.google.android.gms:play-services-location:11.0.1" />

I left in the same version of the plugin that was generated by phonegap-plugin-push.

Related matters:

https://github.com/phonegap/phonegap-plugin-push/issues/1588

https://github.com/phonegap/phonegap-plugin-push/issues/1591

Browser other questions tagged

You are not signed in. Login or sign up in order to post.