应用程序运行时不显示通知。当应用程序关闭时它会起作用。
MyFirebaseMessagingService.java
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = MyFirebaseMessagingService.class.getSimpleName();
private NotificationUtils notificationUtils;
@Override
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 …Run Code Online (Sandbox Code Playgroud) notifications android push-notification foregroundnotification
我正在使用Android Studio 3.0.1。
当我尝试运行应用程序时
INSTALL_FAILED_USER_RESTRICTED:无效的APK
发生错误。
我也禁用即时运行。
我再次运行应用程序,但发生相同的错误。
04/04 10:59:08:启动app
$ adb push G:\ Android \ Fundraiser \ BuyForFund \ app \ build \ outputs \ apk \ debug \ app-debug.apk /data/local/tmp/com.android.buyforfund
$ adb shell pm install -t -r“ /data/local/tmp/com.android.buyforfund”
失败[INSTALL_FAILED_USER_RESTRICTED:无效的APK]$ adb shell pm卸载com.android.buyforfund
DELETE_FAILED_INTERNAL_ERROR
安装APK 时出错
我想在我的应用程序中显示地点的位置。
我收到无法访问 zzbgl的编译错误
这是我的 gradle 文件:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.code.gson:gson:2.8.1'
//noinspection UseOfBundledGooglePlayServices
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.whiteelephant:monthandyearpicker:1.3.0'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.tarun0.zxing-standalone:zxing-standalone:1.0.0'
implementation 'com.edwardvanraak:MaterialBarcodeScanner:0.0.6-ALPHA'
implementation "ru.tinkoff.scrollingpagerindicator:scrollingpagerindicator:1.0.6"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
它显示编译错误
错误:无法访问 …
我在构建 ionic 4 应用程序时遇到问题。每次我尝试构建 android 应用程序时,它都会出现以下错误。
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 19s …Run Code Online (Sandbox Code Playgroud)