在我的 Android 项目中,我介绍了服务 pushwoosh。在示例中,我在 onCreate 方法启动中看到了这一点:
//Register receivers for push notifications
registerReceivers();
//Create and start push manager
PushManager pushManager = PushManager.getInstance(this);
//Start push manager, this will count app open for Pushwoosh stats as well
try {
pushManager.onStartup(this);
}
catch(Exception e)
{
//push notifications are not available or AndroidManifest.xml is not configured properly
}
//Register for push!
pushManager.registerForPushNotifications();
String token= PushManager.getPushToken(this);
checkMessage(getIntent());
1)我想知道我是否应该在每次启动应用程序时都这样做,还是只在第一次启动时这样做。
2)什么是onResume方法和方法OnPause启动registerReceiver和unregisterReceivers?