Android Push Setup - Can't update plugin: closed


#1

I am new to Countly. Have installed the community edition on Digital Ocean. I am trying to enable push for my Android app. When I enter my FCM id I get an error alert that says "Couldn't update plugin: closed". I must be doing something wrong. Can anyone help get me started?


#2

Hi,
It seems your server might not be installed correctly. Could you attach your countly/log/countly-api.log?


#3

Since posting I have had success getting the FCM key into my server. I had a missing character in my cut and paste. However, I am not able to send a Push from my server. Previously, I had my app configured for Firebase and I was successful sending from the Firebase Console - so I know my app was OK, and my Firebase credentials are OK.

I clearly have a problem in my setup. I will check documentation on setting up my app for Countly SDK and repeat the setup and try again. However, I initially installed demo data and cannot figure out how to delete this data. After running my app configured for Countly, I see the user count go up, but there are some 200+ demo users listed as well. Then I got to send a Push, it says it is ready store send to 251 users (250 demo users and my real 1 user). However, the server reports that 0 pushes were sent / received.

Thanks for any help you can give me.

Brian


#4

Hi Brian

Which SDK are you using - React Native SDK or native Android SDK?


#5

I am using the Android SDK. Have been working on the problem and making progress. Deleted the demo data and pushes are not going through! My "DemoFirebaseMessageingService code is called. The device vibrates and a notification icon is displayed in the tray. If I click on it, I see the response in my Countly console.

However, when my app is in the foreground when the Push is received, I do not get a dialog displayed. Instead, the device vibrates, the icon is displayed in the tray the same as if the app was in the background.

My code is from the Countly example:

Boolean result = CountlyPush.displayMessage(getApplicationContext(), message, R.drawable.nectar_leaf_black_background_round, notificationIntent);

Any thoughts on what I doing wrong?

Brian


#6

That should have read that "pushes are now going through", not "not going through". All seems OK except I do not get a dialog when the app is in the foreground.


#7

I tried calling CountlyPush.displayDialog but do not have a reference to my current activity in the Service. Tried with :

Boolean result = CountlyPush.displayDialog(((MainActivity)getApplicationContext()), message);

but of course it crashed the app as one cannot cast application context to an Activity...

I do have: "Countly.sharedInstance().onStart(this);" in my MainActivity.onStart and "Countly.sharedInstance().onStop();" in my MainActivity.onStop.


Countly Push does not show dialog when App is in foreground
#8

Hi!

So it seems you already made your way through. What Android version do you have? I doubt it's too old, so may be you can set up a breakpoint here: https://github.com/Countly/countly-sdk-android/blob/master/sdk-messaging-fcm/src/main/java/ly/count/android/sdk/messaging/CountlyPush.java#L615 and make sure it gets called?


#9

I am testing on a variety of Android version from 7 to 9. I set a breakpoint as requested and it does not get called (though not sure I set it correctly - I set it in .gradel/caches/modules-2/.../sdk-messaging-fcm-18.0.4-sources.jar!/..../messageing/CountlyPush.java). Interestingly when a push is received with the app in the background clicking the notification does not bring the app to the foreground.

I think it may have to do with an age check activity that is listed in the Manifest as a WelcomeActivity






This checks if the user has attested to being of the required age. If they have, then the welcome activity loads MainActivity.

Brian


#10

In Logcat I see:

Activity created: com.chapinsoftware.nectarmobile.MainActivity ( main is com.chapinsoftware.nectarmobile.pushed_activities.WelcomeActivity)

Countly onStart called, [0] -> [1] activities now open

then a bit later

Activity created: com.chapinsoftware.nectarmobile.MainActivity ( main is com.chapinsoftware.nectarmobile.pushed_activities.WelcomeActivity)

Countly onStart called, [1] -> [2] activities now open
Countly onStop called, [2] -> [1] activities now open

Checking referrer: null

Brian


#11

I have resolved the problem. I inadvertently deleted

CountlyPush.init(this, Countly.CountlyMessagingMode.PRODUCTION);

Please close this topic. And thanks!


#12