2***@qq.com
2***@qq.com
  • 发布:2024-09-28 09:39
  • 更新:2024-09-28 09:39
  • 阅读:61

app定时器广播无法接收 BroadcastReceiver

分类:uts
@Suppress("DEPRECATION")  
class AlarmReceiver extends BroadcastReceiver {  
    constructor (){  
        super();  
    }  
    override onReceive(context : Context, intent : Intent) {  
        var action = intent.getAction();  
            Log.d("AlarmReceiver", "Broadcast received: " + action);   
        console.log('ygskyl');  
        if (action.equals("ACTION_FROM_NATIVE")) {  
            var value = intent.getStringExtra("msg");  
            console.log("yhh",value);  
        }  
    }  
}

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="io.dcloud.uni_modules.qtClock">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SET_ALARM" />
<application>
<receiver android:name="uts.sdk.modules.qtClock.AlarmReceiver">
<intent-filter>
<action android:name="uts.sdk.modules.qtClock.ACTION_FROM_NATIVE" />
</intent-filter>
</receiver>
</application>
</manifest>
根据安卓的 logcat 显示 提交是ok的 但是就是无法创建静态监听

2024-09-28 09:39 负责人:无 分享
已邀请:

要回复问题请先登录注册