小编Dim*_*vin的帖子

错误通知:无法展开RemoteViews:StatusBarNotification.在Android Nougat上

OneSignal SDK用来显示通知.我做到了OneSignalPushService.java.

OneSignalPushService.java:

public class OneSignalPushService extends NotificationExtenderService {

    @Override
    protected boolean onNotificationProcessing(OSNotificationReceivedResult notification) {

        if (!TinyDbWrap.getInstance().isPushEnabled()) {
            KLog.d(this.getClass().getSimpleName(), "Notification will not displayed");
            return true;
        }

        OverrideSettings overrideSettings = new OverrideSettings();
        overrideSettings.extender = new NotificationCompat.Extender() {
            @Override
            public NotificationCompat.Builder extend(NotificationCompat.Builder notificationBuilder) {
                notificationBuilder.setDefaults(0);
                notificationBuilder.setContentTitle(getApplicationContext().getResources().getString(R.string.app_name));

                boolean is_in_silent_mode = false; /*or true by user's settings in app*/
                /*TinyDbWrap.getInstance()... - it stores user's settings*/
                KLog.d(OneSignalPushService.class.getSimpleName(), "Notification isSoundPushEnabled: " + TinyDbWrap.getInstance().isSoundPushEnabled());
                if (!is_in_silent_mode && TinyDbWrap.getInstance().isSoundPushEnabled()) {
                    notificationBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
                } else { …
Run Code Online (Sandbox Code Playgroud)

java android android-notifications onesignal android-7.0-nougat

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

反应式java方法hide()

Observable类中的hide方法用于什么?我阅读了该文档,但仍然不知道它的用途是什么,我看到很多人都使用它

 hide()
    Hides the identity of this Observable and its Disposable.
Run Code Online (Sandbox Code Playgroud)

http://reactivex.io/RxJava/javadoc/io/reactivex/Observable.html

我们应该何时使用这种方法?

java android rx-java

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

The IDE cannot create the directory. Possible reason: parent directory is read-only or the user lacks necessary permissions

When I trying to install Android Studio on my PC so the error occurs it says:

The IDE cannot create the directory. Possible reason: parent directory is read-only or the user lacks necessary permissions.

If you have modified the idea.config.path property, please make sure it is correct, otherwise, please re-install the IDE.


Location: C:\Users\Acer/.AndroidStudio4.0/config java.nio.file.AccessDeniedException: C:\Users\Acer.AndroidStudio4.0

在此处输入图片说明

android android-studio

12
推荐指数
4
解决办法
7016
查看次数

为什么RecyclerView'onBindViewHolder中的有效载荷是一个列表?

 public void onBindViewHolder(VH holder, int position, List<Object> payloads) {
        onBindViewHolder(holder, position);
 }
Run Code Online (Sandbox Code Playgroud)

我知道当我们想更新RecyclerView项目中的某些视图而不是全部时,我可以使用

public final void notifyItemChanged(int position, Object payload) {
        mObservable.notifyItemRangeChanged(position, 1, payload);
}
Run Code Online (Sandbox Code Playgroud)

如该代码所示,param是一个对象,但是为什么在Adapter中将其更改为list,而我必须使用它list.get(0)来找到我的有效载荷?

谢谢

java android recycler-adapter android-recyclerview

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

适用于Android Oreo的基于ARM的仿真器

我正在尝试为运行ARM AEBI V7的Oreo(Android 8)创建一个模拟器.我需要这种架构的原因是我包含一个具有本机库的组件,但仅为armae​​bi-v7编译.我无权访问组件的源代码,因此无法重新编译本机代码.

在Android Studio中,当我打开SDK Manager并展开Oreo的选项时,我只看到了X86的模拟器图像.对于早期版本的Android,我可以看到ARM模拟器图像.

我是否应该为奥利奥看到ARM图像?或许这些尚未发布?

android android-emulator android-8.0-oreo

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

当应用程序在奥利奥中被杀死时,广播接收器不工作为什么?

我如何使用 Oreo 中的广播接收器接收传入消息的数据,它在 Oreo 版本之前完美运行,但我无法在 Oreo 中接收,我试图通过开发人员站点的帮助来缩短它,但没有任何示例代码为此,那里只给出了奥利奥限制

这是我的广播接收器类

public class SMSReceiver extends BroadcastReceiver


{
String sender,message;
public void onReceive(Context context, Intent intent) {

    Bundle myBundle = intent.getExtras();
    SmsMessage[] messages = null;
    String strMessage = "";

    if (myBundle != null) {
        Object[] pdus = (Object[]) myBundle.get("pdus");
        messages = new SmsMessage[pdus.length];

        SmsMessage shortMessage=SmsMessage.createFromPdu((byte[]) pdus[0]);
        for (int i = 0; i < messages.length; i++) {
            messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
            sender=messages[i].getOriginatingAddress();

            String message =shortMessage.getMessageBody();



        Toast.makeText(context, sender+"\n"+message, Toast.LENGTH_SHORT).show();


        }

    }

}
Run Code Online (Sandbox Code Playgroud)

这是我的清单

<?xml version="1.0" encoding="utf-8"?> …
Run Code Online (Sandbox Code Playgroud)

java android android-broadcastreceiver android-8.0-oreo

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

Android - 尝试添加应用程序快捷方式时出错

我的应用有minSdk = 21和targetSdk = 26

我想设置应用程序快捷方式

我已将<meta-data>标记添加到应用启动时启动的第一个活动.

<activity android:name=".SignInActivity"
            android:theme="@style/SubscriptionsTheme.NoActionBar">
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
            <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts"/>
        </activity>
Run Code Online (Sandbox Code Playgroud)

然后我创建了xml-v25目录,并在其中包含此shortcuts.xml文件:

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
    <shortcut
        android:shortcutId="test"
        android:icon="@drawable/plus"
        android:shortcutShortLabel="test"
        android:shortcutLongLabel="long test" >

        <intent
            android:action="android.intent.action.VIEW"
            android:targetPackage="com.xxxxx.xxxxx.xxxxx"
            android:targetClass="com.xxxxx.xxxxx.xxxxxx.main" />

    </shortcut>
</shortcuts> 
Run Code Online (Sandbox Code Playgroud)

当我尝试构建应用程序时,我收到以下错误:

错误:错误:'long test'与属性android:shortcutLongLabel(attr)引用不兼容.错误:错误:'test'与属性android:shortcutShortLabel(attr)引用不兼容.错误:'long test'与属性android:shortcutLongLabel(attr)引用不兼容.

android android-shortcut

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

java.lang.NoClassDefFoundError:解析失败:Lcom/google/android/gms/auth/api/signin/internal/zzz;

在我的onResume()MainActivity 方法中,我有这个,它应该让玩家登录 Google Play 游戏:

\n\n
protected void onResume(){\n    super.onResume();\n    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);\n    sign_in_player();\n    Log.d("MainActivity", "State: Resumed");\n\n\n}\nprivate static void sign_in_player(){\n\n    if(!is_signed_into_play_games()){\n        GoogleSignInClient google_sign_in_client = GoogleSignIn.getClient(current_context,GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);\n        google_sign_in_client.silentSignIn();\n    }\n}\npublic static boolean is_signed_into_play_games(){\n    return GoogleSignIn.getLastSignedInAccount(current_context)!= null;\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

build.gradle 依赖项:

\n\n
dependencies {\n    implementation fileTree(include: [\'*.jar\'], dir: \'libs\')\n    androidTestImplementation(\'com.android.support.test.espresso:espresso-core:2.2.2\', {\n    exclude group: \'com.android.support\', module: \'support-annotations\'\n})\n    implementation \'com.google.android.gms:play-services-identity:15.0.1\'\n    implementation \'com.google.android.gms:play-services-games:15.0.1\'\n    implementation \'com.google.android.gms:play-services-ads:15.0.0\'\n    implementation \'com.google.android.gms:play-services-auth:11.6.0\'\n    implementation "com.android.support:appcompat-v7:27.1.1"\n    implementation \'com.android.support.constraint:constraint-layout:1.1.2\'\n    testImplementation \'junit:junit:4.12\'\n    implementation \'com.google.android.gms:play-services-games:15.0.1\'\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

在我的 AndroidManifest 中,我确保该应用程序使用互联网:

\n\n

<uses-permission android:name="android.permission.INTERNET" />

\n\n

我正在我的 S8 上测试这个应用程序(应用程序未发布或任何其他内容)。我最终得到这个运行时错误:

\n\n …

android android-gradle-plugin

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

构建签名 APK 时 com.googlecode.libphonenumber:libphonenumber:8.8.2 中缺少元数据

我在我的项目中添加了 com.googlecode.libphonenumber:libphonenumber:8.8.2。在调试模式下,它正常工作。但在签名的 apk 中,当调用库方法时会生成以下异常。

Caused by: java.lang.IllegalStateException: missing metadata: /com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD
    at com.google.i18n.phonenumbers.e.getMetadataFromSingleFileName(SourceFile:188)
    at com.google.i18n.phonenumbers.e.getMetadataFromMultiFilePrefix(SourceFile:116)
    at com.google.i18n.phonenumbers.g.getMetadataForRegion(SourceFile:64)
    at com.google.i18n.phonenumbers.PhoneNumberUtil.getMetadataForRegion(SourceFile:2211)
    at com.google.i18n.phonenumbers.PhoneNumberUtil.getMetadataForRegionOrCallingCode(SourceFile:1330)
    at com.google.i18n.phonenumbers.PhoneNumberUtil.parseHelper(SourceFile:3197)
    at com.google.i18n.phonenumbers.PhoneNumberUtil.parse(SourceFile:3025)
    at com.google.i18n.phonenumbers.PhoneNumberUtil.parse(SourceFile:3015)
    at com.revesoft.itelmobiledialer.util.aq.b(SourceFile:697)ode here
Run Code Online (Sandbox Code Playgroud)

android libphonenumber android-gradle-plugin

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

如何将值传递给此方法?

我在该类中有一个dll以下方法

 [MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
    bool SetIPAddress([MarshalAs(UnmanagedType.BStr)] ref string lpszIPAddress, int dwPortNumber, int dwPassWord);
Run Code Online (Sandbox Code Playgroud)

如何将值传递给此方法:

public FP_CLOCKLib._DFP_CLOCK   ff = new FP_CLOCKLib.FP_CLOCK();
Run Code Online (Sandbox Code Playgroud)

从C#访问OCX库时,拒绝创建类似“灾难性故障”的实例

bool status = ff.SetIPAddress(ref ip, 5005, 0);
Run Code Online (Sandbox Code Playgroud)

它抛出错误

System.Runtime.InteropServices.COMException(0x8000FFFF):灾难性故障(来自HRESULT的异常:0x8000FFFF(E_UNEXPECTED))位于System.RuntimeType.ForwardCallToInvokeMember(String memberName,BindingFlags标志,对象目标,Int32 [] aWrapperTypes,MessageDatab_gDataData)中。 FP_CLOCKClass.SetIPAddress(String&lpszIPAddress,Int32 dwPortNumber,Int32 dwPassWord)

c# asp.net

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