Google Cloud Messaging - messages sometimes not received until network state changed

后端 未结 5 1795
我寻月下人不归
我寻月下人不归 2020-11-28 04:40

While working on a little project that integrates with GCM, I\'ve stumbled across a bit of a strange issue.

Some times when I start watching the log to see if messag

5条回答
  •  执念已碎
    2020-11-28 05:30

    As per your comment in above answer and according to my experience with GCM push notifications there isn't any reason that if network(internet connection) is available you should not receive push notifications I always check internet connection availability before running the application for push notification like this try checking this if this is true you should receive push notifications

        private boolean isNetworkAvailable() {
        ConnectivityManager connectivityManager 
              = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null;
    }
    

提交回复
热议问题