小编Muh*_*aza的帖子

在screen_on上更新android小部件的最佳方法是什么.是否支持Android Oreo(API 26)

我创建了一个非常好的小部件,然后由于Google Play Developer Console的要求,我将targetSDK从23更改为26.

切换到Android SDK 26后,我的app小部件不再更新screen_on/User_present事件.我可以看到,由于(后台执行限制),后续运行任务在Android 26中有很多变化.

以下是我的问题?

Q1-如何在每个screen_on事件上更新我的app小部件,以便用户在小部件上看到正确的状态?

Q2-如何每隔1小时定期更新我的应用小部件?

以下代码我正在使用.

static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
                                int appWidgetId) {

        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.app_widget);
        String token = getToken();
        getUUID();
        getGatewayActivationStatus();
        getEnvironment();
        if (token != null) {
            remoteViews.setViewVisibility(R.id.layoutBtn, View.VISIBLE);
            AppWidgetIntentReceiver appWI = new AppWidgetIntentReceiver();
            appWI.getMode(context);
        } else {
            remoteViews.setTextViewText(R.id.txt_mode, "Please sign into your App to see status.");
            remoteViews.setViewVisibility(R.id.layoutBtn, View.INVISIBLE);
        }

        remoteViews.setOnClickPendingIntent(R.id.btn_refresh, buildButtonPendingIntent(context, _refresh));
        remoteViews.setOnClickPendingIntent(R.id.txt_mode, buildButtonPendingIntent(context, _openApp));

        appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
    }


    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) …
Run Code Online (Sandbox Code Playgroud)

java android android-widget cordova ionic-framework

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

以下构建命令失败:CompileC

我正在使用IONIC框架.但是在创建IOS Build时,我收到了这个错误:

** BUILD FAILED **


The following build commands failed:
        CompileC build/abodea.build/Debug-iphonesimulator/abodea.build/Objects-normal/i386/PowerManagement.o abodea/Plugins/at.gofg.sportscomputer.powermanagement/PowerManagement.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Mehdi/Desktop/Development/project_abode_s 04-02-2016/project_abode_s/platforms/ios/cordova/build-debug.xcconfig,-project,abodea.xcodeproj,ARCHS=i386,-target,abodea,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/Mehdi/Desktop/Development/project_abode_s 04-02-2016/project_abode_s/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/Mehdi/Desktop/Development/project_abode_s 04-02-2016/project_abode_s/platforms/ios/build/sharedpch
Run Code Online (Sandbox Code Playgroud)

我不确定发生了什么.我正在使用这些命令:

cordova platform add ios
cordova build ios
Run Code Online (Sandbox Code Playgroud)

Android版本非常好......

ios cordova ionic-framework

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

标签 统计

cordova ×2

ionic-framework ×2

android ×1

android-widget ×1

ios ×1

java ×1