Issue
I have an issue that my receiver doesnt receive... How strange...
I feel like I read every other post on stackoverflow, but nothing works.
Target is Android 10, device is also running android 10 and this is my receiver.
[BroadcastReceiver(Name = "com.meac.ReaderService.BootComplete", Enabled = true, Exported = true, Permission = "RECEIVE_BOOT_COMPLETED")]
[IntentFilter(new[] { Intent.ActionBootCompleted })]
public class BootComplete : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
string text = "Boot completed";
ToastLength duration = ToastLength.Short;
var toast = Toast.MakeText(context, text, duration);
toast.Show();
/* if (intent.Action.Equals(Intent.ActionBootCompleted))
{
Intent s = new Intent(context, typeof(ReaderService));
context.StartService(s);
Intent s2 = new Intent(context, typeof(GuardService));
context.StartService(s);
// StartRDP(context);
}*/
}
}
And this is my manifest, which should contain all needed permissions.
<?xml version="1.0" encoding="utf-8"?>
<!--
This code was generated by a tool.
It was generated from C:\Users\tomas.filip\source\repos\ReaderService_V2\ReaderService_V2\Properties\AndroidManifest.xml
Changes to this file may cause incorrect behavior and will be lost if
the contents are regenerated.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.meac.ReaderService" android:installLocation="internalOnly" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="27" android:targetSdkVersion="29" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
<uses-permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<uses-permission android:name="android.permission.PERSISTENT_ACTIVITY" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application android:name="android.app.Application" android:allowBackup="true" android:appComponentFactory="androidx.core.app.CoreComponentFactory" android:debuggable="true" android:extractNativeLibs="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
<receiver android:name="com.meac.ReaderService.BootComplete" android:enabled="true" android:exported="true" android:permission="RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="crc64bdb27b5d294e9832.GuardService" />
<activity android:name="crc64bdb27b5d294e9832.MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="crc64bdb27b5d294e9832.ReaderService" />
<activity android:name="crc646957603ea1820544.MediaPickerActivity" android:configChanges="orientation|screenSize|uiMode" />
<service android:name="crc64396a3fe5f8138e3f.KeepAliveService" />
<receiver android:name="crc64a0e0a82d0db9a07d.BatteryBroadcastReceiver" android:enabled="true" android:exported="false" android:label="Essentials Battery Broadcast Receiver" />
<receiver android:name="crc64a0e0a82d0db9a07d.EnergySaverBroadcastReceiver" android:enabled="true" android:exported="false" android:label="Essentials Energy Saver Broadcast Receiver" />
<receiver android:name="crc64a0e0a82d0db9a07d.ConnectivityBroadcastReceiver" android:enabled="true" android:exported="false" android:label="Essentials Connectivity Broadcast Receiver" />
<activity android:name="crc64a0e0a82d0db9a07d.IntermediateActivity" android:configChanges="orientation|screenSize" />
<provider android:name="xamarin.essentials.fileProvider" android:authorities="com.meac.ReaderService.fileProvider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/xamarin_essentials_fileprovider_file_paths" />
</provider>
<activity android:name="crc64a0e0a82d0db9a07d.WebAuthenticatorIntermediateActivity" android:configChanges="orientation|screenSize" />
<provider android:name="mono.MonoRuntimeProvider" android:authorities="com.meac.ReaderService.mono.MonoRuntimeProvider.__mono_init__" android:exported="false" android:initOrder="1999999999" />
<!-- suppress ExportedReceiver -->
<receiver android:name="mono.android.Seppuku">
<intent-filter>
<action android:name="mono.android.intent.action.SEPPUKU" />
<category android:name="mono.android.intent.category.SEPPUKU.com.meac.ReaderService" />
</intent-filter>
</receiver>
</application>
</manifest>
I have manually enabled display over other apps permission.
I have spent on it 6 hours today and I am completely lost.
It will be 100% something stupid.
Hope so someone who can understand that can look into that. Thanks.
Solution
Fixed that by adding categories into the intent filter.
[IntentFilter(actions: new[] { Intent.ActionBootCompleted }, Categories = new []{ Intent.CategoryDefault })]
Answered By - Tomáลก Filip
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.