Ich habe eine broadcast receiver
erstellt, um Standortaktualisierungen von Google Fused Location API
zu empfangen. In meinem Rundfunkempfänger habe ich eine Benachrichtigung eingerichtet, um die Standortkoordinaten anzuzeigen. Am Anfang funktionierte alles gut, aber jetzt kann ich keine Benachrichtigungen erhalten.Benachrichtigung wird nicht angezeigt
Hier ist meine logcat:
07-14 14:55:01.730 1129-1129/? I/dalvikvm: DexOpt: access denied from Landroid/support/v4/app/NotificationCompatKitKat; to field Landroid/app/Notification;.actions
07-14 14:55:05.274 510-525/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x56f982f8
07-14 14:55:05.411 510-745/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x597bfe08
07-14 14:55:05.580 804-815/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x576cca28
07-14 14:55:07.493 26570-28863/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x51612400
07-14 14:55:07.499 26570-28864/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x516297e8
07-14 14:55:07.510 26570-28863/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x5160d788
07-14 14:55:07.518 26570-26582/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x51681818
07-14 14:55:07.538 26570-26581/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x5165bd50
07-14 14:55:07.554 26570-28864/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x51617630
07-14 14:55:07.557 510-521/? D/IPCThreadState: [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x597bfe08
07-14 14:55:07.648 1179-1179/com.svtech.thirdeye.thirdeye I/dalvikvm: Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
07-14 14:55:07.648 1179-1179/com.svtech.thirdeye.thirdeye W/dalvikvm: VFY: unable to resolve virtual method 242: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
07-14 14:55:07.648 1179-1179/com.svtech.thirdeye.thirdeye I/dalvikvm: DexOpt: access denied from Lcom/google/android/gms/common/GooglePlayServicesUtil; to field Landroid/app/Notification;.extras
07-14 14:55:07.722 1179-1179/com.svtech.thirdeye.thirdeye I/dalvikvm: Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method gsi.a
07-14 14:55:07.722 1179-1179/com.svtech.thirdeye.thirdeye W/dalvikvm: VFY: unable to resolve virtual method 527: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
07-14 14:55:07.722 1179-1179/com.svtech.thirdeye.thirdeye I/dalvikvm: DexOpt: access denied from Lgsi; to field Landroid/app/Notification;.extras
07-14 14:55:07.950 1179-1179/com.svtech.thirdeye.thirdeye I/dalvikvm: Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method kk.a
07-14 14:55:07.951 1179-1179/com.svtech.thirdeye.thirdeye W/dalvikvm: VFY: unable to resolve virtual method 1338: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
07-14 14:55:07.951 1179-1179/com.svtech.thirdeye.thirdeye I/dalvikvm: DexOpt: access denied from Lkk; to field Landroid/app/Notification;.extras
Hier ist meine BroadCast Receiver
Klasse:
public class LocationHandlerReceiver extends BroadcastReceiver {
public static final int NOTIFICATION_ID = 1;
public LocationHandlerReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
if (LocationResult.hasResult(intent)) {
LocationResult locationResult = LocationResult.extractResult(intent);
Location mLocation = locationResult.getLastLocation();
Log.i("Intent Service", mLocation.toString());
setupNotification(context, mLocation);
}
}
//Setup Notification
private void setupNotification(Context context, Location location) {
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(context, MainActivity.class), 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.location_start_notification)
.setContentTitle(context.getResources().getString(R.string.location_notification))
.setContentText("Lat: " + location.getLatitude() + ", Long: " + location.getLongitude());
mBuilder.setContentIntent(contentIntent);
mBuilder.setAutoCancel(true);
mBuilder.setLocalOnly(false);
mBuilder.setOngoing(true);
NotificationManager mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
}
PS: Ich teste App auf Android 4.2.2, API 17. Auf meiner ersten paar Durchläufe , Benachrichtigung wurde angezeigt.
EDIT: Hier ist meine Manifest
Datei:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.svtech.thirdeye.thirdeye">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:name="android.support.multidex.MultiDexApplication">
..........
<receiver
android:name=".BroadcastReceivers.LocationHandlerReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="thirdeye.LOCATION_RECEIVED" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</receiver>
</application>
Kann mir jemand helfen, das Problem zu identifizieren ????
Haben Sie auch Ihre LocationHandlerReceiver als ' ' in Ihrem Manifest ? –
Marat
Warum haben Sie Ihren Receiver als ' '? –
Marat
um es dem Benutzer zu ermöglichen, die App zu öffnen, wenn er auf die Benachrichtigung tippt ... aber für mein Problem ist es irrelevant. Ich habe versucht, das auch zu entfernen .. es war mein Fehler ... @Marat –