0

Hi am getting this error after Location Permission request success. after permission success am requesting location using LocationService as follows.

 LocationServices.GeofencingApi.addGeofences(mApiClient, mGeofenceList, mGeofenceRequestIntent);

I searched on google regarding this, i can not find out exact solution to solve this issue as this is instant app module. But in my project apk module location request working file without any issue.

here is my complete log

  E/Isotope: UID: [10135]  PID: [21567] IActivityManagerProxy : Instant app: xxx.yyy.zzz crashed: java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=42, result=0, data=Intent { (has extras) }} to activity {xxx.yyy.zzz/com.karumi.dexter.DexterActivity}: java.lang.SecurityException: PendingIntent's target package can't be different to the request package.
    at android.app.ActivityThread.deliverResults(ActivityThread.java:4130)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4173)
    at android.app.ActivityThread.-wrap20(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6165)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
 Caused by: java.lang.SecurityException: PendingIntent's target package can't be different to the request package.
    at android.os.Parcel.readException(Parcel.java:1684)
    at android.os.Parcel.readException(Parcel.java:1637)
    at com.google.android.gms.location.internal.zzi$zza$zza.zza(Unknown Source)
    at com.google.android.gms.location.internal.zzl.zza(Unknown Source)
    at com.google.android.gms.location.internal.zzf$1.zza(Unknown Source)
    at com.google.android.gms.location.internal.zzf$1.zza(Unknown Source)
    at com.google.android.gms.common.api.internal.zza$zza.zzb(Unknown Source)
    at com.google.android.gms.common.api.internal.zzg.zza(Unknown Source)
    at com.google.android.gms.common.api.internal.zzg.zzb(Unknown Source)
    at com.google.android.gms.common.api.internal.zzl.zzb(Unknown Source)
    at com.google.android.gms.common.api.internal.zzj.zzb(Unknown Source)
    at com.google.android.gms.location.internal.zzf.addGeofences(Unknown Source)
    at com.google.android.gms.location.internal.zzf.addGeofences(Unknown Source)
    at xxx.yyy.zzz.activity.HomeActivity$1.onPermissionGranted(HomeActivity.java:219)
    at com.karumi.dexter.MultiplePermissionsListenerToPermissionListenerAdapter.onPermissionsChecked(MultiplePermissionsListenerToPermissionListenerAdapter.java:48)
    at com.karumi.dexter.MultiplePermissionListenerThreadDecorator$1.run(MultiplePermissionListenerThreadDecorator.java:45)
    at com.karumi.dexter.MainThread.execute(MainThread.java:32)
    at com.karumi.dexter.MultiplePermissionListenerThreadDecorator.onPermissionsChecked(MultiplePermissionListenerThreadDecorator.java:43)
    at com.karumi.dexter.DexterInstance.onPermissionsChecked(DexterInstance.java:278)
    at com.karumi.dexter.DexterInstance.updatePermissionsAsGranted(DexterInstance.java:252)
    at com.karumi.dexter.DexterInstance.onPermissionRequestGranted(DexterInstance.java:141)
    at com.karumi.dexter.Dexter.onPermissionsRequested(Dexter.java:175)
    at com.karumi.dexter.DexterActivity.onRequestPermissionsResult(DexterActivity.java:54)
    at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7098)
    at android.app.Activity.dispatchActivityResult(Activity.java:6950)

Code for pending intent

  private PendingIntent getGeofenceTransitionPendingIntent() {
    Intent intent = new Intent(xxx.yyy.zzz.activity.HomeActivity.this, xxx.yyy.zzz.activity.GeofenceTransitionsIntentService.class);
    return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
Anbarasu Chinna
  • 975
  • 9
  • 28
  • `LocationServices.GeofencingApi.addGeofences(GoogleApiClient, List, PendingIntent);` is deprecated. Use `LocationServices.GeofencingApi.addGeofences(GoogleApiClient, GeofencingRequest, PendingIntent);` instead, by creating a GeofencingRequest first: `GeofencingRequest geofenceRequest = new GeofencingRequest.Builder().addGeofences(mGeofencesToAdd).build();` – Farmer Jun 29 '18 at 13:10
  • I will check and let you know #Shailesh – Anbarasu Chinna Jun 29 '18 at 13:12
  • I checked with your code. Not working. It seems the error is because of PendingIntent not the GeofencingRequest. – Anbarasu Chinna Jun 29 '18 at 13:16
  • Check this https://stackoverflow.com/questions/26633796/android-locationservices-geofencingapi-example-usage – Farmer Jun 29 '18 at 13:42
  • Post your pendingIntent. The error says it involves the package name used, so what package did you use vs your app's package name? – TWL Jun 29 '18 at 23:23
  • added pending intent code – Anbarasu Chinna Jul 02 '18 at 07:38
  • what happens when you change the `this` in `getService(this,...` so it specifically references the same package? – TWL Jul 03 '18 at 18:57
  • Oh, and when you run this as an installed-app, does this exception happen? – TWL Jul 03 '18 at 18:57
  • No. apk works fine. instant app only gives error – Anbarasu Chinna Jul 04 '18 at 08:31
  • Please file this issue to Google @ https://issuetracker.google.com/issues/new?component=316045&template=1018787 You will need to provide a sample project. – TWL Jul 06 '18 at 23:42

0 Answers0