- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我搜索了关于堆栈溢出的不同答案。即使我禁用服务和广播接收器,它也会显示错误。
这是我的 list 文件:-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appzoy.croatiaapp">
<!-- to make api calls -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- for qr code scanning -->
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:fullBackupContent="@xml/backup_descriptor">
<activity
android:name=".MainActivity" />
<activity android:name=".LoginActivity" />
<activity
android:name=".TicketsListActivity"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateHidden" />
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SettingsActivity"
android:theme="@style/AppTheme.NoActionBar"></activity>
<receiver android:name=".receivers.AlarmReceiverSubmit"
android:exported="false"
android:enabled="true"/>
<service android:name=".services.AlarmService"
android:exported="false"
android:enabled="true"/>
<receiver android:name=".receivers.NetworkChangeReceiver"
android:exported="false"
android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
</receiver>
</application>
每当我关闭抽屉导航时,SettingsActivity
就会出现在前台,这是我使用此代码设置警报的 Activity :-
private void setAlarm(Calendar calSet) {
Toast.makeText(this, "Alarm is set @ " + calSet.getTime(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getBaseContext(), AlarmService.class);
PendingIntent pendingIntent = PendingIntent.getService(getBaseContext(), 1, intent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calSet.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pendingIntent);
}
private void setAlarmSubmitTickets(Calendar calSet) {
Toast.makeText(this, "Alarm is set @ " + calSet.getTime(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getBaseContext(), AlarmReceiverSubmit.class);
intent.putExtra("selectedTime", txtSendTicketsTime.getText().toString());
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 1, intent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calSet.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pendingIntent);
}
我的日志文件如下:-
03-13 10:12:48.253 1576-22821/? E/ActivityManager: Sending non-protected broadcast com.motorola.motocare.INTENT_TRIGGER from system 4512:com.motorola.process.system/1000 pkg com.motorola.motgeofencesvc java.lang.Throwable at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:18226) at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18826) at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:512) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2906) at android.os.Binder.execTransact(Binder.java:565)
最佳答案
如果您在 AndroidManifest.xml 中声明了 "android:sharedUserId="android.uid.system"
,则声明 protected 广播。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.mypackage"
android:sharedUserId="android.uid.system">
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="24" />
<protected-broadcast android:name="com.motorola.motocare.INTENT_TRIGGER" />
您可以使用 Android Studio 进行构建。
关于android - 发送不 protected 广播 com.motorola.motocare.INTENT_TRIGGER java.lang.Throwable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49248539/
我搜索了关于堆栈溢出的不同答案。即使我禁用服务和广播接收器,它也会显示错误。 这是我的 list 文件:-
我是一名优秀的程序员,十分优秀!