Search code examples
androidpdfandroid-activityandroid-4.2-jelly-bean

Trouble Launching PDF Viewer (Polaris) on Android 4.1 (Samsung)


We are creating an Activity to view a PDF file on Android Jelly Bean 4.1, and the Samsung Galaxy S3 launches Polaris Viewer by default. The first time we do this, it works. But the second time we do it, we get this error:

E/ActivityThread( 6788): Activity
com.infraware.polarisoffice4.viewer.PDFViewerActivity has leaked IntentReceiver com.infraware.polarisoffice4.viewer.PDFViewerActivity$2@4219c850 that was originally registered here. Are you missing a call to unregisterReceiver()?
E/ActivityThread( 6788): android.app.IntentReceiverLeaked: Activity com.infraware.polarisoffice4.viewer.PDFViewerActivity has leaked IntentReceiver com.infraware.polarisoffice4.viewer.PDFViewerActivity$2@4219c850 that was originally registered here. Are you missing a call to unregisterReceiver()?
E/ActivityThread( 6788):    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:792)
E/ActivityThread( 6788):    at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
E/ActivityThread( 6788):    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1254)
E/ActivityThread( 6788):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1241)
E/ActivityThread( 6788):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1235)
E/ActivityThread( 6788):    at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)
E/ActivityThread( 6788):    at com.infraware.polarisoffice4.viewer.PDFViewerActivity.onCreate(PDFViewerActivity.java:109)
E/ActivityThread( 6788):    at android.app.Activity.performCreate(Activity.java:5206)
E/ActivityThread( 6788):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
E/ActivityThread( 6788):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
E/ActivityThread( 6788):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
E/ActivityThread( 6788):    at android.app.ActivityThread.access$600(ActivityThread.java:140)
E/ActivityThread( 6788):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
E/ActivityThread( 6788):    at android.os.Handler.dispatchMessage(Handler.java:99) E/ActivityThread( 6788):     at android.os.Looper.loop(Looper.java:137)
E/ActivityThread( 6788):    at android.app.ActivityThread.main(ActivityThread.java:4898)
E/ActivityThread( 6788):    at java.lang.reflect.Method.invokeNative(Native Method)
E/ActivityThread( 6788):    at java.lang.reflect.Method.invoke(Method.java:511)
E/ActivityThread( 6788):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
E/ActivityThread( 6788):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
E/ActivityThread( 6788):    at dalvik.system.NativeStart.main(Native Method)

If we install Adobe Reader, then we don't get this exception (even if we still choose Polaris as the viewer in the dialog box). If we uninstall Adobe Reader, the exception comes back.

If we kill our process and restart, we'll be able to view one PDF in Polaris, but then we'll get the exception when we look at a second PDF. (Doesn't matter what PDF we view: the first one we view will open, the second one will not.)

Any suggestions?


Solution

  • Since we could not fix the problem, we decided to just check before we hand off the PDF to be viewed to see if Polaris is the only viewer installed. If it is, we suggest the user should go get Adobe Reader.