1

As of 13-11-18, I was sharing APK files on WhatsApp, for testing apps within a circle of people, with no problem whatsoever. But as of today, if I try to open an apk, I get an error toast saying:

You may not have the proper app to view this content.

Did they change their policies and decided not to let people share APK files on their platform?

I don't use third party websites for sharing APKs, where mostly Chrome spooks most people saying that "This type of file may harm your device".

  • 1
    Open .apk file from file explorer (/sdcard/WhatsApp/Media/WhatsApp Documents/) instead of WhatsApp. Or zip your apk file before sending over WhatsApp. – Irfan Latif Nov 14 '18 at 7:03
  • my friends are not so big on going so deep in their devices... how did it stop working...did the latest update come with a bug? – Pemba Tamang Nov 14 '18 at 7:13
  • I don't think so any changes have been made related to this. Usually there is problem handling the proper content according to file type. Are you sure file is being sent with .apk extension? What version of Android your friends are using? – Irfan Latif Nov 14 '18 at 7:58
  • I am getting the same error since I tried for the first time... Install the apk through the file manager. – Rajendran Nadar Nov 14 '18 at 8:31
  • @IrfanLatif lollipop and above.. well it was working properly till now – Pemba Tamang Nov 14 '18 at 10:45
3

Well as per my understanding this is how files are opened from WhatsApp making use of file extensions:

  • File type is determined from extension (getMimeTypeFromExtension) and intent.action.VIEW is launched provided with file path dat= and file type typ=.
  • If the file extension is not known, file is treated as octet-stream mime type.
  • List of preferred apps (/data/system/users/0/package-restrictions.xml which is built from user selected defaults and files at /system/etc/preferred-apps/*.xml) is checked for activities that can handle this file type.
  • If there is only one app that can handle this mime type, that app (activity) is launched. You can see which app handles what mime type by:

    dumpsys package preferred-xml
    

    Use adb shell or one of permission.DUMP or root is required.

  • If there are multiple apps (more than one matching activity for the given intent) available and no preferred app is already set, ResolverActivity (from Android framework resources) is launched (not intent.action.CHOOSER) showing a dialog to select app (for Once or Always).
  • If the file type is apk (typ=application/vnd.android.package-archive) and PackageInstaller is set to handle this file, action.INSTALL_PACKAGE is invoked.
  • Now if Android version is Oreo or above and WhatsApp is updated, it would need permission.REQUEST_INSTALL_PACKAGES to install unknown package. Once granted, app will be installed.

You can use logcat to view how this whole process goes on. Use adb shell or one of permission.READ_LOGS or root is required. You can share results here to help me and others understand where the chain breaks.

Workaround:
Make sure that files are sent and received with correct extension i.e. .apk. If WhatsApp is unable to handle downloaded apk file for any reason, use a File Manager. Explore to /sdcard/WhatsApp/Media/WhatsApp Documents and install apk file.

RELATED: Alternative “File Open” (not stack “DocumentsUi”) for WhatsApp?

  • Hi, when I click the apk the error toast pops up with the following warning I/ActivityManager: START u0 {act=android.intent.action.VIEW dat=content://com.whatsapp.provider.media/item/50743 typ=application/vnd.android.package-archive flg=0x1} from uid 10072 on display 0 – Pemba Tamang Nov 19 '18 at 4:33
  • typ= application means whatapp can see the type of the file right? – Pemba Tamang Nov 19 '18 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.