我正在我的 firebase 分析中发送自定义事件,并且事件的值之一显示(未设置)。
我已经用日志和所有内容交叉检查了所有内容,以及值和参数名称,此事件没有任何空白,但在某些情况下,它仍然显示(未设置)。
if(!TextUtils.isEmpty(listdata.get(position).getPersonalizationTitle())){
firebaseEvents.createNewEvent("personalization_selection",
listdata.get(position).getPersonalizationTitle(),
"category_name");
}
public void createNewEvent(String event_name, String title, String values_title) {
if (!TextUtils.isEmpty(values_title) && !TextUtils.isEmpty(title)) {
Bundle params = new Bundle();
params.putString(values_title, title);
firebaseAnalytics.logEvent(event_name, params);
Log.d("FIREBASE_EVENTS", event_name + "--" + params);
}
}
Run Code Online (Sandbox Code Playgroud) 我想获取整个设备的日志,logcat 显示设备中运行的进程的方式。我想从我的 android 应用程序中捕获它。
下面是启动前台服务的代码。它适用于许多设备,如三星、moto、Vivo、Oppo 以及 Android 版本的牛轧糖和奥利奥,但不适用于一加设备。任何人都可以告诉我是否需要任何额外的更改或许可才能在一加设备上运行,或者是否有任何模拟器支持一加手机。
public class ForegroundService extends Service {
private Context ctx;
private static final String PRIMARY_NOTIF_CHANNEL = "default";
@Override
public void onCreate() {
super.onCreate();
ctx = this;
createNotificationService();
}
private void createNotificationService(){
TelephonyManager mTelephonyManager = (TelephonyManager) ctx.getSystemService(TELEPHONY_SERVICE);
if(mTelephonyManager != null)
mTelephonyManager.listen(new CellTowerStateListener(ctx), PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
Intent notificationIntent = new Intent(this, MainActivity.class);
notificationIntent.setAction(Constants.ACTION.MAIN_ACTION);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TASK);
//PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
RemoteViews notificationView = new RemoteViews(this.getPackageName(), R.layout.notification);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setupChannel();
}
Notification notification = new NotificationCompat.Builder(this, …Run Code Online (Sandbox Code Playgroud) android foregroundnotification foreground-service oneplusone oneplusthree