简体   繁体   中英

Why an activity doesn't start?

I call an aidl method that calls me back after some logic, in this callback method I try to start an Activity, but the activity doesn't start and there are no exceptions. Interesting fact, it works on Android 9, but on 10 and 6 doesn't.

Manifest

<activity
            android:name=".views.ReceiptsActivity"
            android:launchMode="singleInstance"
            android:windowSoftInputMode="stateHidden|adjustPan">
            <intent-filter>
                <action android:name="com.bifit.cashdesk.mobile.views.ReceiptsActivity" />
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
</activity>

StartActivity() Method

    private void showActivity() {
        Intent intent = new Intent(context, context.getClass());
        intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        context.startActivity(intent);
    }

Aidl callback method

aidlService.cancel(new IOperationResponse.Stub() {
                @Override
                public void onResponse(String resultCode, String responseData, String rrn, String billJson) {
                    showActivity();
                }
            }, "com.bifit.cashdesk.mobile.views.ReceiptsActivity", rrn);

I have tried to resolve this by user-permissions, but it haven't led to success

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

It was on the side of aidl app, this app didn't close when used callback. We resolved it by closing aidl app on callback on it's side

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM