UNLocationNotificationTrigger不在后台触发设备

时间:2017-05-20 21:01:58

标签: ios notifications location local unusernotificationcenter

我正在构建一个使用位置敏感的本地通知的应用。即使应用程序处于后台,我也希望这些能够触发。我能够让它在模拟器中工作,但不是设备。它们在设备上发射但仅在前景中发射。

以下是我的设置方法:

public class CustomerTariff extends DomainEntity {

    private Customer customer;
    //some other similar fields
    private Tariff tariff;

    public CustomerTariff() {
    }

    public CustomerTariff(Customer customer
                          Tariff tariff) {
        this.customer = customer;
        this.tariff = tariff;
    }

    public CustomerTariff(Long id, Customer customer,
                          Tariff tariff) {
        super(id);
        this.customer = customer;
        this.tariff = tariff;
    } 
    //getters and setters

    @Override
    public String toString() {
    return "CustomerTariff{" +
            "customer=" + customer +
            ", tariff=" + tariff +
            "} " + super.toString();
    }
}

public abstract class DomainEntity {

    private Long id;

    public DomainEntity() {}

    public DomainEntity(Long id) {
       this.id = id;
    }

    @Override
    public String toString() {
       return "DomainEntity{" +
               "id=" + id +
                '}';
       }
    }

0 个答案:

没有答案