小编Bes*_*art的帖子

在范围内找不到类型“GADInterstitial”?

我刚刚将 Google 移动广告 SDK 升级到 8.0 版,但出现此错误:

在范围内找不到类型“GADInterstitial”

我还将此代码添加到 AppDelegate:

GADMobileAds.sharedInstance().start(completionHandler: nil)
Run Code Online (Sandbox Code Playgroud)

在我升级到 8.0 版之前,Google 移动广告 SDK 运行良好

注意:我还在我的应用中使用 Firebase 框架。

xcode admob ios swift

9
推荐指数
3
解决办法
3998
查看次数

如何使用 Realm 在 Kotlin 中重置 MongoDB 用户密码?

您好,我正在使用 MongoDB 作为我的 Android 应用程序,我正在使用 Compose 进行开发,我需要在我的应用程序中添加重置密码功能。

mongoDB.getApp().emailPasswordAuth.resetPassword(password, tokenId, token)这是我发现的,但我不知道如何获得tokentokenId

我也尝试过mongoDB.getApp().emailPasswordAuth.sendResetPasswordEmail("email@gmail.com"),但这会导致一个错误,其中显示:

io.realm.kotlin.mongodb.exceptions.BadRequestException:[Service][BadRequest(48)] 请通过函数使用重置密码。

android realm mongodb kotlin android-jetpack-compose

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

无法检查radiobutton

为什么我在以编程方式取消选中后无法检查相同的单选按钮,当我单击下一个按钮时,除非我检查另一个单选按钮.

这是取消选中radiobuttons的代码:

        if(q.trim() != null || q.trim() != ""){
            questionView.setText(q);
            r1.setChecked(false);
            r2.setChecked(false);
            r3.setChecked(false);

            r1.clearFocus();
            r2.clearFocus();
            r3.clearFocus();

            r1.setText(varNames.get("ra0"));
            r2.setText(varNames.get("ra1"));
            r3.setText(varNames.get("ra2"));
        }
Run Code Online (Sandbox Code Playgroud)

这是我尝试检查的地方:

public void questionClicked(View view) {

    boolean checked = ((RadioButton) view).isChecked();

    switch(view.getId()) {
        case R.id.firstQuestion:
            if(!checked) {
                r1.setChecked(true);
            }
            getAnswer(R.id.firstQuestion);

            break;
        case R.id.secondQuestion:
            if(!checked) {
                r2.setChecked(true);
            }
            getAnswer(R.id.secondQuestion);

            break;
        case R.id.thirdQuestion:
            if(!checked) {
                r3.setChecked(true);
            }
            getAnswer(R.id.thirdQuestion);

            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

java android radio

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

如何使用 Material Design 更改 Actionbar 文本颜色?

我在我的 Android 应用程序中使用 Material Design,我想更改操作栏文本颜色和后退按钮颜色。

此代码不起作用:

    <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowContentOverlay">@null</item>
    <!--<item name="android:textSize">3sp</item>-->
    <item name="android:actionBarStyle">@style/MyTheme.ActionBarStyle</item>

</style>

<style name="MyTheme.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style>

<style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/titleColor</item>
</style>
Run Code Online (Sandbox Code Playgroud)

java android android-theme android-actionbar material-design

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

类型错误:未定义不是对象(正在评估“navigator.serviceWorker.addEventListener”)

我想使用 Firebase Cloud Messaging 向用户发送通知,但当我尝试设置消息传递时收到此错误:

TypeError:未定义不是一个对象(评估“navigator.serviceWorker.addEventListener”)在node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6在reportException在node_modules/react-native/Libraries/Core/ExceptionsManager。 js:172:19 在 node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 在handleError 在node_modules/@react-native/polyfills/error-guard.js:49:36 在 ErrorUtils.reportFatalError在node_modules/metro-runtime/src/polyfills/require.js:204:6 在guardedLoadModule 在Screens/Tabs/Profile/UserData.js:16:4 在UserData

这是我的代码:

import { initializeApp, getApps, getApp } from "firebase/app";
import {getMessaging, getToken} from 'firebase/messaging';

const firebaseConfig = {
   apiKey: "...",
   appId: "...",
   authDomain: "...",
   projectId: "...",
   messagingSenderId: "...",
   storageBucket: "...",
};

export const firebaseApp = getApps().length === 0 ? initializeApp(firebaseConfig) : getApp(); 
const messaging = getMessaging(firebaseApp);


getToken(messaging, { vapidKey: '...' }).then((currentToken) => {
    if (currentToken) {
      // Send the token to your server and …
Run Code Online (Sandbox Code Playgroud)

javascript push-notification firebase react-native firebase-cloud-messaging

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