小编err*_*337的帖子

Android 本地通知不适用于三星 Galaxy

很长一段时间以来,我都在为 Android 上的复杂本地通知而苦苦挣扎。

我有一个事件列表。用户可以选择何时收到通知:

  • 活动当天
  • 活动开始前一天
  • 活动开始前两天

他/她还可以设置他/她想要得到通知的时间。每一次都是可能的。他/她也只能收到不同类型事件的通知。

发生的情况是,它适用于除三星 Galaxy 手机以外的所有设备。用户告诉我,他们只收到一次通知(在他们设置时),然后再也不会收到通知。

我几乎尝试了所有方法,但我的想法已经用完了。三星似乎在通知方面存在一些问题,但它适用于其他一些应用程序。那么他们的代码和我的有什么区别。

也许其他人知道这个问题并且可以帮助我。这太棒了!

这是我的代码:

public int setEventNotifications(List<Event> chosenEvents) {

    SharedPreferences settings = context.getSharedPreferences(Constants.PREFS_EVENT_SETTINGS, 0);

    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    ArrayList<PendingIntent> intentArray = new ArrayList<>();

    // To cancel an existing pending intent you need to recreate the exact same and cancel it -__-
    // So pending intents need to be stored in the database
    deleteOldGarbagePendingIntents();

    // get notification settings from shared prefs

    int hours = 0;
    int minutes = 0;

    String …
Run Code Online (Sandbox Code Playgroud)

java android android-notifications samsung-galaxy

10
推荐指数
1
解决办法
530
查看次数

如何使用gitlab-ci-multi-runner在GitLab CI中自动运行测试

我开始使用gitlab-ci-runner-for Windows(64位)来使用GitLab CI.到目前为止一切正常,有与我的存储库的连接,我的配置工作在每次推送时开始.

我现在要做的是让一个作业运行npm install以下载所有依赖项,一个作业通过运行karma start karma.conf.js或使用grunt并运行来执行我用karma/jasmine编写的所有测试grunt test.

所以我尝试的第一份工作是:

cd app
npm install
karma start karma.conf.js
Run Code Online (Sandbox Code Playgroud)

前两个命令被执行,但最后一个命令被完全忽略.所以我试图分开工作.第一个命令获得自己的工作(选项卡"并行运行"),最后一个命令移动到"成功运行"选项卡中的自己的工作.现在所有依赖项都已安装,第二个作业开始.到目前为止一切顺利,但第二项工作从删除所有以前安装的依赖项开始,然后尝试运行karma start karma.conf.js.这显然最终导致所有测试都失败,因为没有下载npm依赖"angular-mocks".如果我添加npm install到第二个工作(这对我来说没有多大意义),业力任务将再次被忽略.

这里有什么问题?我怎样才能解决这个问题?有没有办法不总是下载每个测试执行的所有依赖项?

unit-testing angularjs karma-runner gitlab-ci

8
推荐指数
1
解决办法
6078
查看次数

为iOS创建离子资源不再有效

我正准备我的离子应用程序在iOS应用程序商店中进行更新,但我现在真的陷入困境,因为使用资源ionic resources不再起作用.

在终端中运行命令后,它开始上传我放入文件夹的资源,然后告诉我上传已成功完成,然后完全冻结.Android和iOS文件夹被创建,也是图标和启动文件夹,但是没有更多的事情发生.

到目前为止我尝试了什么:
- 替换资源文件夹中的icon.psd和splash.psd
- 使用ionic state reset(完全删除平台并再次添加它们)重置离子状态+从离子网站添加官方图标和启动模板

使用的版本:
- Cordova CLI:5.1.1
- 离子版本:1.1.0
- Ionic CLI版本:1.6.5
- ios-deploy:5.0.1
- ios-sim:5.0.1
- Mac OS X Yosemite
- 节点:0.12 0.7

在Windows上一切都很好用于生成android资源.

有人可以帮忙吗?

ios ionic-framework ionic

6
推荐指数
1
解决办法
2998
查看次数

Jasmine - 检查控制器方法中的服务方法是否被调用

我前一天开始用Jasmine测试我的ionic/angularjs应用程序.我不确定我是否完全误解了测试的想法,但我想测试控制器方法中的服务方法是否被调用以及控制器如何对返回的任何内容作出反应.

我想测试的控制器功能如下:

$scope.init = function() {
    DataService.fetchValues('dataprotection').then(function (result) {
        $scope.dataprotection = result;
    }, function (failure) {
        $scope.dataprotection = 'No dataprotection available';
    });
};
Run Code Online (Sandbox Code Playgroud)

我的测试应该如下所示:

describe('DataprotectionController', function () {
    beforeEach(inject(function ($rootScope, $controller, DataService) {
        scope = $rootScope.$new();
        controller = $controller('DataprotectionCtrl', {
            '$scope': scope
        });

        dataService = DataService;
    }));

    it('Should init dataprotection on startup', function () {
        // call init function in controller
        scope.init();
        //check if dataservice.fetchValues have been called with 'dataprotection' as parameter
        expect(dataService, 'fetchValues').toHaveBeenCalledWith('dataprotection');
        //calling fetchValues should init scope.dataprotection variable …
Run Code Online (Sandbox Code Playgroud)

testing jasmine angularjs

2
推荐指数
1
解决办法
6163
查看次数

如何从 flutter 应用程序中的 pubspec.yaml 中提取应用程序版本,以便在 Windows 上运行的 github 操作中使用它?

我想pubspec.yaml使用 github actions 提取我的 flutter 应用程序的文件版本,然后重用此版本并将其附加到文件名。

这是我的main.yaml步骤:

build_on_push:
    if: github.event_name == 'push'
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v3
      - name: Get version from pubspec.yaml
        # this step echos "D:\a\my_app\my_app>set APP_VERSION=1.0.0+1" 
        run: |
          type pubspec.yaml | findstr /r "version:[^^]*" | for /f "tokens=2 delims=: " %%a in ('findstr /r /c:"version:[^^]*" pubspec.yaml') do set APP_VERSION=%%a
          echo APP_VERSION=!APP_VERSION!>>$GITHUB_ENV
        shell: cmd
      # doesnt work
      - name: Display the version retrieved from pubspec
        run: echo ${{ env.APP_VERSION }}
        shell: cmd
      # …
Run Code Online (Sandbox Code Playgroud)

windows cmd flutter github-actions

1
推荐指数
1
解决办法
836
查看次数