通知を受信するかどうかをユーザーに許可/無効にしようとしています。私は通知のためのチェックボックスを実装し、プリファレンスクラスを作成することができました。プッシュボットからプッシュ通知を無効にする方法
これは、私は、チェックボックスのチェックを外ししかし、私はまだ通知を受け取った私の好みのクラス
import com.pushbots.push.Pushbots;
...
public class UserSettings extends PreferenceActivity {
private CheckBoxPreference notification;
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.prefs);
SharedPreferences settingsPrefs = PreferenceManager.getDefaultSharedPreferences(this);
notification = (CheckBoxPreference) findPreference("prefSendNotification");
notification.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceChange(Preference preference,
Object newValue) {
if (newValue.toString().equals("true"))
{
notificationsOn();
Pushbots.sharedInstance().setNotificationEnabled(true);
}
else
{
notificationsOff();
Pushbots.sharedInstance().setNotificationEnabled(false);
}
return true;
}
private void notificationsOn() {
Pushbots.sharedInstance().setNotificationEnabled(true);
}
private void notificationsOff() {
Pushbots.sharedInstance().setNotificationEnabled(false);
}
@Override
public boolean onPreferenceClick(Preference preference) {
// TODO Auto-generated method stub
return false;
}
});
}
}
です。 問題が何ですか?
はhttps://github.com/pushbots/enable-disable-push-exampleではなく、作品をpushbotsかIDKのあなたが試しているものを実装しているようですが、そのコードでも登録されています。 – zapl
まだ通知を受け取るボックスはチェックされていません – Kevin