X-SLAYER / notification_listener_service

Flutter plugin to listen to all incoming notifications (posted or removed) with the possibility to reply to them
https://pub.dev/packages/notification_listener_service
MIT License
21 stars 25 forks source link

Error while trying to run #3

Closed akhilgorantala closed 2 years ago

akhilgorantala commented 2 years ago

Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present] Error launching application on LE2101.

X-SLAYER commented 2 years ago

can you try to add this to the intent filter android:exported="false" Like that

<service android:label="notifications" android:name="notification.listener.service.NotificationListener"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" android:exported="false">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>
akhilgorantala commented 2 years ago

yes i added false, but still not able to build.

X-SLAYER commented 2 years ago

can you share ur AndroidManifest with full error log

akhilgorantala commented 2 years ago

`

`

log: `Performing Streamed Install

adb: failed to install C:\Users\AKHIL\StudioProjects\notification_listener_service_1\example\build\app\outputs\flutter-apk\app.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl967353062.tmp/base.apk (at Binary XML file line #22): notification.listener.service.NotificationListener: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present] Error launching application on LE2101. `

X-SLAYER commented 2 years ago

can you try to add this to the intent filter android:exported="false" Like that

<service android:label="notifications" android:name="notification.listener.service.NotificationListener"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" android:exported="false">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>

did you change the service with this one ?

X-SLAYER commented 2 years ago

can you try to add this to the intent filter android:exported="false" Like that

<service android:label="notifications" android:name="notification.listener.service.NotificationListener"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" android:exported="false">
        <intent-filter>
            <action android:name="android.service.notification.NotificationListenerService" />
        </intent-filter>
    </service>

this will solve the problem

sabeelmuttil commented 11 months ago

@X-SLAYER In my case error showing like this

═╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following PlatformException was thrown while activating platform stream on channel
x-slayer/notifications_event:
PlatformException(error, com.payx.app: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be
specified when a receiver isn't being registered exclusively for system broadcasts, null, null)

When the exception was thrown, this was the stack:
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
message_codecs.dart:652
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
platform_channel.dart:310
<asynchronous suspension>
#2      EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:652:9)
platform_channel.dart:652
<asynchronous suspension>
════════════════════════════════════════