oppo,vivo应用程序终止通知不在android fcm中出现
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了oppo,vivo应用程序终止通知不在android fcm中出现,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2986字,纯文字阅读大概需要5分钟。
内容图文
在Motorola中测试应用程序,当该应用程序被杀死时,三星可以正常工作.但是当我在体内测试应用程序时,oppo在应用程序被破坏的情况下无法正常工作.
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.e(TAG, "From: " + remoteMessage.getFrom());
if (remoteMessage == null)
return;
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.e(TAG, "Notification Body: " + remoteMessage.getNotification().getBody());
// handleNotification(remoteMessage.getNotification().getBody());
}
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.e(TAG, "Data Payload: " + remoteMessage.getData().toString());
try {
JSONObject json = new JSONObject(remoteMessage.getData().toString());
handleDataMessage(json);
} catch (Exception e) {
Log.e(TAG, "Exception: " + e.getMessage());
}
}
}
Android清单xml:
<service
android:name="notification.MyFirebaseMessagingService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="notification.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
我没有收到有关vivo的消息,建议您提供任何帮助.
解决方法:
Infinix Note 5 (Android One- Oreo) and Oppo F9(Oreo) are not getting
push notification if app is killed, they work fine if app is in
background or foreground.
从最近的应用程序托盘中刷过应用程序后,使用(氧气操作系统,MIUI等)的中文ROM会终止(类似于强制停止).由于这个原因,每项任务都会在后台运行,例如服务,因此乔布斯会被该应用杀死.即使是高优先级FCM也看不到中文ROM中的日光
Real time problems :
1)您无法获取用户的位置.因此,如果取决于实时位置,则任何应用都无法正常运行
2)您无法接收FCM高优先级通知
3)如果应用不在托盘中,则将没有时间特定的任务/作业会执行,等等.
Solution
用户需要在应用程序的设置中启用自动启动功能,以保持后台服务/作业的运行.默认情况下,该功能处于关闭状态.要在我们可以使用的某些设备中执行此操作,
样例代码
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent();
String manufacturer = android.os.Build.MANUFACTURER;
switch (manufacturer) {
case "xiaomi":
intent.setComponent(new ComponentName("com.miui.securitycenter",
"com.miui.permcenter.autostart.AutoStartManagementActivity"));
break;
case "oppo":
intent.setComponent(new ComponentName("com.coloros.safecenter",
"com.coloros.safecenter.permission.startup.StartupAppListActivity"));
break;
case "vivo":
intent.setComponent(new ComponentName("com.vivo.permissionmanager",
"com.vivo.permissionmanager.activity.BgStartUpManagerActivity"));
break;
}
List<ResolveInfo> arrayList = getPackageManager().queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
if (arrayList.size() > 0) {
startActivity(intent);
}
}
}
内容总结
以上是互联网集市为您收集整理的oppo,vivo应用程序终止通知不在android fcm中出现全部内容,希望文章能够帮你解决oppo,vivo应用程序终止通知不在android fcm中出现所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。