31

I like Office Lens's ability to automatically crop, focus, and align a picture... mainly for receipt and expense processing

I want to have an app flow that goes like this:

  1. User opens my app and clicks photograph receipt
  2. Lens opens (android intent, or similar in iOS)
  3. User takes picture
  4. Picture is returned to my application for processing

I am having trouble making that flow happen, and to make the data transfer (photo) between the camera and my app seamless. What options do I have?

halfbit
  • 54,462
  • 46
  • 195
  • 426
  • What sort of app are you looking to build, is this an office add-in or some other kind of app? You have tagged the question with office-addins, but I wanted to double check – Martin Kearn Feb 23 '16 at 09:13

1 Answers1

3

If you look at Androidmanifest.xml file, you will see this XML:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.microsoft.office.officelens" platformBuildVersionCode="21" platformBuildVersionName="5.0.1-1624448">
    <uses-permission android:name="android.permission.CAMERA" android:required="true"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
    <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
    <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.READ_PROFILE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
    <uses-feature android:name="android.hardware.camera" android:required="true"/>
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
    <application android:allowBackup="true" android:icon="@drawable/ic_officelens" android:label="@string/officelens_app_name" android:largeHeap="true" android:name="com.microsoft.office.officelens.OfficeLensApplication" android:theme="@style/OfficeLensAppTheme">
        <activity android:label="@string/officelens_app_name" android:name="com.microsoft.office.apphost.LaunchActivity" android:theme="@style/OfficeLensSplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:configChanges="orientation|screenSize" android:label="@string/officelens_app_name" android:launchMode="singleTask" android:name="com.microsoft.office.officelens.MainActivity" android:theme="@style/FullscreenTheme"/>
        <activity android:label="@string/officelens_app_name" android:name="com.microsoft.office.officelens.SecureActivity" android:parentActivityName="com.microsoft.office.officelens.MainActivity" android:windowSoftInputMode="stateHidden"/>
        <activity android:label="@string/title_activity_settings" android:name="com.microsoft.office.officelens.SettingsActivity" android:parentActivityName="com.microsoft.office.officelens.MainActivity"/>
        <activity android:configChanges="orientation|screenSize" android:label="" android:name="com.microsoft.office.officelens.AboutActivity" android:parentActivityName="com.microsoft.office.officelens.SettingsActivity"/>
        <activity android:label="" android:name="com.microsoft.office.officelens.FirstRunActivity" android:parentActivityName="com.microsoft.office.officelens.MainActivity" android:screenOrientation="portrait" android:theme="@style/OfficeLensFirstRunTheme"/>
        <activity android:label="@string/title_activity_section_picker" android:name="com.microsoft.onenote.pickerlib.OneNotePickerActivity" android:theme="@style/Theme.AppCompat.Light"/>
        <activity android:exported="false" android:icon="@drawable/ms_logo" android:label="@string/webflow_header" android:name="com.microsoft.onlineid.authenticator.AccountAddPendingActivity" android:theme="@style/Theme.MSA"/>
        <activity android:configChanges="orientation|screenSize" android:exported="false" android:icon="@drawable/ms_logo" android:label="@string/webflow_header" android:name="com.microsoft.onlineid.internal.ui.WebWizardActivity" android:theme="@style/Theme.MSA" android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="com.microsoft.onlineid.internal.SIGN_IN"/>
                <action android:name="com.microsoft.onlineid.internal.RESOLVE_INTERRUPT"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:configChanges="orientation|screenSize" android:exported="false" android:icon="@drawable/ms_logo" android:label="@string/webflow_header" android:name="com.microsoft.onlineid.ui.AddAccountActivity" android:theme="@style/Theme.MSA" android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="com.microsoft.onlineid.internal.ADD_ACCOUNT"/>
                <action android:name="com.microsoft.onlineid.internal.SIGN_UP_ACCOUNT"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <activity android:configChanges="orientation|screenSize" android:exported="false" android:name="com.microsoft.onlineid.ui.SignOutActivity" android:theme="@style/Theme.MSA.Transparent"/>
        <activity android:exported="false" android:icon="@drawable/ms_logo" android:label="@string/webflow_header" android:name="com.microsoft.onlineid.internal.ui.AccountPickerActivity" android:theme="@style/Theme.MSA.Dialog">
            <intent-filter>
                <action android:name="com.microsoft.onlineid.internal.PICK_ACCOUNT"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
        <service android:exported="false" android:name="com.microsoft.onlineid.internal.MsaService">
            <intent-filter>
                <action android:name="com.microsoft.onlineid.internal.GET_TICKET"/>
                <action android:name="com.microsoft.onlineid.internal.UPDATE_PROFILE"/>
                <action android:name="com.microsoft.onlineid.internal.SIGN_OUT"/>
                <action android:name="com.microsoft.onlineid.internal.SIGN_OUT_ALL_APPS"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </service>
        <service android:enabled="true" android:exported="false" android:name="com.microsoft.onlineid.sso.service.MsaSsoService">
            <intent-filter>
                <action android:name="com.microsoft.msa.action.SSO_SERVICE"/>
            </intent-filter>
            <meta-data android:name="com.microsoft.msa.service.sso_version" android:value="1"/>
            <meta-data android:name="com.microsoft.msa.service.sdk_version" android:value="@string/sdk_version_name"/>
        </service>
    </application>
    <uses-permission android:name="com.android.vending.CHECK_LICENSE"/>
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
    <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
    <uses-feature android:name="android.hardware.telephony" android:required="false"/>
</manifest>

If you read this file carefully you will see that this is impossible to interact this the other API's. Neither 'broadcast' no proper 'intent-filter' to interact this the other applications.

This is impossible nowadays.

Anyway, obviously, you can save to local storage and retrieve the data from SD card using your app.

Vyacheslav
  • 23,112
  • 16
  • 96
  • 174
  • 1
    so the closed way would to start the app at MainActivity screen and let the user share the taken picture with my own app? – cyptus Sep 12 '16 at 14:57
  • 1
    I think yes. Share in the internal/external storage. – Vyacheslav Sep 12 '16 at 15:01
  • How/where did you get that manifest file? Office Lens is now integrated into OneNote and other Microsoft products so I would like to see if it is now available as a published intent. – Martin Robins Feb 29 '20 at 13:45
  • @MartinRobins It was more than 3 years ago. I don't actually know current status – Vyacheslav Feb 29 '20 at 13:48
  • @Vyacheslav; Thanks, but I was asking how you got the manifest file as I was hoping to be able to get the latest version of the manifest and see for myself if anything has changed. – Martin Robins Mar 03 '20 at 11:05
  • @MartinRobins just download latest APK to your device. For example, all installed applications are downloaded to a particular folder. Use adb to retrieve it from an Android device to your computer and unzip or extract APK-file using android features. There are a lot of them. For example, fern flower. https://stackoverflow.com/q/4032960/1979882 and https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine – Vyacheslav Mar 04 '20 at 19:22