Launch app from Open File on Android?

I’m trying to enable a user to email a file from my app and then import the file into the same app on another device. This file is a application specific file, it’s essentially a text file. I’ve got it working great on iOS but not at all on Android.

I have discovered that on Android, I can’t just open the file from the email, I have to download it to the download directory and then open it. By itself this isn’t terrible but the file won’t open even from Downloads. I click the file and it says “Open File: No apps can perform this action.”

The file extension is “.skchar”. I’m testing on a Galaxy 4. I’m using the default email application, the one that is titled “Email”.

From my research I have ascertained that I need the proper intent filter to make my app browsable. This is my current usesPermissions and intent filter in my build.settings:

[lua]

usesPermissions =

        {

            “android.permission.INTERNET”,

            “android.permission.WRITE_EXTERNAL_STORAGE”,

            “android.permission.READ_EXTERNAL_STORAGE”,

            “android.permission.ACCESS_NETWORK_STATE”,

            “android.app.episodes.permission.SEND_MULTIPLE_TO_STORYALBUM”, – this was added because of the error message below, it didn’t help.

            “com.android.vending.BILLING”,

            “com.android.vending.CHECK_LICENSE”,

            “android.permission.GET_ACCOUNTS”,

            “android.permission.RECEIVE_BOOT_COMPLETED”,

            “com.google.android.c2dm.permission.RECEIVE”,

            “.permission.C2D_MESSAGE”,

        },

intentFilters =

        {

            {

                label = “import file”,

                actions = {“android.intent.action.VIEW”, “android.intent.action.EDIT”},

                categories =

                {

                    “android.intent.category.DEFAULT”,

                    “android.intent.category.BROWSABLE”

                },

                data = 

                {

                    scheme = “file”,

                    --mimeType= “application/skchar”,

                    --pathPattern = “.*\.skchar”

                }

            },

        },[/lua]

According to the documentation, this intent filter should offer my app when you try to open any file. The commented out parts of the “data” section are to demonstrate other things I have tried which haven’t made a difference.

The file I am trying to open was created on an iOS device and emailed, if that matters.

In addition, every time I try to use showpopup to email the file from my TemporaryDirectory on Android, the system throws a Permission denied error and closes the app. I get a system message that says “Unfortunately, <appname> has stopped.”

The error log looks like this:

W/ActivityManager(&nbsp; 815): Permission Denial: starting Intent { act=android.intent.action.SEND flg=0x1 cmp=com.samsung.android.app.episodes/.ui.timeline.NewEpisodeActivity (has clip) (has extras) } from ProcessRecord{42e4e058 15125:com.my.app.name/u0a246} (pid=15125, uid=10246) requires com.samsung.android.app.episodes.permission.SEND\_MULTIPLE\_TO\_STORYALBUM E/AndroidRuntime(15125): FATAL EXCEPTION: main E/AndroidRuntime(15125): Process: com.my.app.name, PID: 15125 E/AndroidRuntime(15125): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.SEND flg=0x1 cmp=com.samsung.android.app.episodes/.ui.timeline.NewEpisodeActivity (has clip) (has extras) } from ProcessRecord{42e4e058 15125:com.my.app.name/u0a246} (pid=15125, uid=10246) requires com.samsung.android.app.episodes.permission.SEND\_MULTIPLE\_TO\_STORYALBUM E/AndroidRuntime(15125): at android.os.Parcel.readException(Parcel.java:1465) E/AndroidRuntime(15125): at android.os.Parcel.readException(Parcel.java:1419) E/AndroidRuntime(15125): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2309) E/AndroidRuntime(15125): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1437) E/AndroidRuntime(15125): at android.app.Activity.startActivityForResult(Activity.java:3516) E/AndroidRuntime(15125): at android.app.Activity.startActivityForResult(Activity.java:3477) E/AndroidRuntime(15125): at com.ansca.corona.CoronaActivity.showSendMailWindowUsing(CoronaActivity.java:1841) E/AndroidRuntime(15125): at com.ansca.corona.CoronaShowApiHandler.showSendMailWindowUsing(CoronaShowApiHandler.java:52) E/AndroidRuntime(15125): at com.ansca.corona.Controller$9.run(Controller.java:1011) E/AndroidRuntime(15125): at android.os.Handler.handleCallback(Handler.java:733) E/AndroidRuntime(15125): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime(15125): at android.os.Looper.loop(Looper.java:157) E/AndroidRuntime(15125): at android.app.ActivityThread.main(ActivityThread.java:5356) E/AndroidRuntime(15125): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(15125): at java.lang.reflect.Method.invoke(Method.java:515) E/AndroidRuntime(15125): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) E/AndroidRuntime(15125): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) E/AndroidRuntime(15125): at dalvik.system.NativeStart.main(Native Method) D/SSRMv2:Monitor(&nbsp; 815): SIOP:: AP = 380, Prev AP = 380, Duration = 10045, PST = 358 D/SSRMv2:AmoledAdjustTimer(&nbsp; 815): prevTemp = 276, currTemp = 276, prevStep = 4, currStep = 4 W/ActivityManager(&nbsp; 815): &nbsp; Force finishing activity com.my.app.name/com.ansca.corona.CoronaActivity E/MP-Decision( 2335): num online cores: 1 reqd : 4 available : 4 rq\_depth:5.100000 hotplug\_avg\_load\_dw: 54 E/MP-Decision( 2335): UP cpu:1 core\_idx:1 Nw:1.900000 Tw:140 rq:5.100000 seq:138.000000 E/MP-Decision( 2335): UP cpu:2 core\_idx:2 Nw:2.700000 Tw:90 rq:5.100000 seq:138.000000 E/MP-Decision( 2335): UP cpu:3 core\_idx:3 Nw:3.500000 Tw:90 rq:5.100000 seq:138.000000 D/dalvikvm(&nbsp; 815): GC\_FOR\_ALLOC freed 3438K, 18% free 64452K/78524K, paused 210ms, total 211ms D/STATUSBAR-NetworkController( 1221): onSignalStrengthsChanged signalStrength=SignalStrength: 99 99 -90 -40 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 cdma 0x30 level=3 W/ContextImpl(&nbsp; 815): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1482 com.android.server.am.ActivityStack.startPausingLocked:1006 com.android.server.am.ActivityStack.finishActivityLocked:3162 com.android.server.am.ActivityStack.finishTopRunningActivityLocked:3005 com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked:3130&nbsp; V/SmartFaceService - 3rd party pause(&nbsp; 815): onReceive [android.intent.action.ACTIVITY\_STATE/com.my.app.name/pause] I/dumpstate(15339): begin D/STATUSBAR-NetworkController( 1221): onSignalStrengthsChanged signalStrength=SignalStrength: 99 99 -90 -40 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 cdma 0x30 level=3 D/AlarmManagerService(&nbsp; 815): Kernel timezone updated to 240 minutes west of GMT I/SpenGestureManager(&nbsp; 815): setFocusWindow0 D/EnterpriseDeviceManager(&nbsp; 815): ContainerId: 0 V/WindowOrientationListener(&nbsp; 815): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false V/WindowOrientationListener(&nbsp; 815): mSContextAutoRotationListener.getProposedRotation, Rotation: -1 V/WindowOrientationListener(&nbsp; 815): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false V/WindowOrientationListener(&nbsp; 815): mSContextAutoRotationListener.getProposedRotation, Rotation: -1 D/PointerIcon(&nbsp; 815): setMouseIconStyle1 pointerType: 1001iconType:101 flag:0 D/PointerIcon(&nbsp; 815): setMouseCustomIcon IconType is same.101 D/CrashAnrDetector(&nbsp; 815): processName: com.my.app.name D/STATUSBAR-StatusBarManagerService(&nbsp; 815): manageDisableList what=0x0 pkg=WindowManager.LayoutParams V/WindowManager(&nbsp; 815): rotationForOrientationLw(orient=-1, last=0); user=0&nbsp; sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false D/PointerIcon(&nbsp; 815): setHoveringSpenIconStyle1 pointerType: 10001iconType:1 flag:0 D/PointerIcon(&nbsp; 815): setHoveringSpenCustomIcon IconType is same.1 D/CrashAnrDetector(&nbsp; 815): broadcastEvent : com.my.app.name&nbsp;data\_app\_crash W/Settings( 1462): Setting airplane\_mode\_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value. D/RestrictionPolicy(&nbsp; 815): isStatusBarExpansionAllowed : true W/ContextImpl(&nbsp; 815): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1482 com.android.server.analytics.data.collection.application.CrashAnrDetector.broadcastEvent:296 com.android.server.analytics.data.collection.application.CrashAnrDetector.processDropBoxEntry:254 com.android.server.analytics.data.collection.application.CrashAnrDetector.access$100:60 com.android.server.analytics.data.collection.application.CrashAnrDetector$1.onReceive:102&nbsp;

Any advice would be really appreciated. I’m very stuck.