Can I integrate Microsoft Lens into my application?
Asked Answered
M

1

32

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?

Marybelle answered 28/8, 2015 at 15:46 Comment(2)
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 checkAsturias
Did you find a solution for this problem? The app flow you described is exactly what I want to do too.Meshuga
H
4

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.

Horseshit answered 7/9, 2016 at 11:39 Comment(6)
so the closed way would to start the app at MainActivity screen and let the user share the taken picture with my own app?Mention
I think yes. Share in the internal/external storage.Horseshit
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.Shepp
@MartinRobins It was more than 3 years ago. I don't actually know current statusHorseshit
@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.Shepp
@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://mcmap.net/q/63516/-how-do-i-get-an-apk-file-from-an-android-device/1979882 and github.com/JetBrains/intellij-community/tree/master/plugins/…Horseshit

© 2022 - 2024 — McMap. All rights reserved.