iOS plist and Android manifest for file association permission

18 views
Skip to first unread message

P5music

unread,
Jan 6, 2021, 3:31:46 PM1/6/21
to CodenameOne Discussions
My CodenameApp needs no further permissions than what is default for CodenameOne builds (internet, writing). Yet, it has to respond to the user selecting a custom file type with a "proprietary" extension.

The relevant code is already in my app, and the simulator allowed to test the basic functioning of the feature.

Now I am going to test the app on real devices. It is intended for iOS at present time but I will test it both on Android and iOS devices.
I have to put the Android and iOS file-association settings.

I read the documentation and it seems that I have to add some files in the native android and ios folders.
I have a plist file from the XCode version of my app. How have I to use it?
As to Android what I have to add in the folder? A section of manifest?
Thanks in advance

Shai Almog

unread,
Jan 6, 2021, 10:08:52 PM1/6/21
to CodenameOne Discussions
You can use the ios.plist_inject build hint. Android has multiple manifest related build hints, you'll need to be more specific with the changes you need.

P5music

unread,
Jan 7, 2021, 8:01:39 AM1/7/21
to CodenameOne Discussions
for iOS I have:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeDescription</key>
<string>description</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.json</string>
<string>public.database</string>
<string>public.data</string>
<string>public.text</string>
<string>public.content</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.myappname.data</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>ext</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/json</string>
</array>
</dict>
</dict>
</array>

for Android
<intent-filter>
            <action android:name="android.intent.action.SEND" />

            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.PICK" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.OPENABLE" />
            <data android:scheme="file" />
            <data android:scheme="content" />
            <data android:mimeType="*/*" />

            </intent-filter>
where in the Android version of my app I had to surrender associating it with the extension because that seems not to work on Android (!)

I opened the project CN settings and I can add build hints but I do not know how to put this in the form of build hints.

I also need the FINE LOCATION permission.

Thanks,
regards 

Shai Almog

unread,
Jan 8, 2021, 3:10:47 AM1/8/21
to CodenameOne Discussions
You will get the fine location permission implicitly if you use the location API. Just write these hints as a single line. See this https://www.codenameone.com/blog/associating-your-app-with-file-extension-mime-types-iphone-android-windows.html
Reply all
Reply to author
Forward
0 new messages