Share Image from Gallery via My App in xamarin forms - xamarin.forms

I want to share an image from the phone gallery. My app should be in sharing options. How can I do that in Xamarin Forms. Give me suggestion to resolve this issue

in Android ,add the following code in Manifest.xml
<intent-filter . . . >
<data android:mimeType="video/mpeg" android:scheme="http" />
<data android:mimeType="audio/mpeg" android:scheme="http" />
//. . . add all mimetype which your app support here
</intent-filter>
in iOS
Add the following code in Info.plist .
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>LSItemContentTypes</key>
<array>
<string>public.item</string>
<string>public.content</string>
</array>
</dict>
</array>
For more type you can check System-Declared Uniform Type Identifiers.

Related

Is it in the Gluon API to keep our app in Portrait Mode even if the user rotates their device in Landscape Mode?

After styling my app in portrait mode, I've discovered its layout is not acceptable should the user manipulate their phone to invoke the app into landscape mode. I can put in the time later to rewrite/retest the UX for both portrait and landscape mode, but for the time being is the a way for us to have our app hold portrait mode all the time?
There is no API or Attach service for this yet.
However you can modify the AndroidManifest.xml file (Android) or the Default-Info.plist file (iOS) to force one single orientation, instead of the existing portrait and landscape ones.
Android
See https://docs.gluonhq.com/#_android_2 for reference.
The AndroidManifest.xml file is generated for the project with the gluonfx:package goal, and it is available at target/gluonfx/aarch64-android/gensrc/android.
Copy this file to src/android and make any modification needed:
Portrait
<?xml version='1.0'?>
<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='$your_package' android:versionCode='1' android:versionName='1.0'>
<application android:label='$your_label' android:icon="#mipmap/ic_launcher">
<activity android:name='com.gluonhq.helloandroid.MainActivity'
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait">
<intent-filter>
<category android:name='android.intent.category.LAUNCHER'/>
<action android:name='android.intent.action.MAIN'/>
</intent-filter>
</activity>
</manifest>
Landscape
<?xml version='1.0'?>
<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='$your_package' android:versionCode='1' android:versionName='1.0'>
<application android:label='$your_label' android:icon="#mipmap/ic_launcher">
<activity android:name='com.gluonhq.helloandroid.MainActivity'
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape">
<intent-filter>
<category android:name='android.intent.category.LAUNCHER'/>
<action android:name='android.intent.action.MAIN'/>
</intent-filter>
</activity>
</manifest>
Then run again gluonfx:package, the final manifest will contain the changes.
iOS
See for reference https://docs.gluonhq.com/#_ios_2.
The configuration is defined by the keys UISupportedInterfaceOrientations and UISupportedInterfaceOrientations-ipad. By default with values:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
Add the file src/main/resources/META-INF/substrate/ios/Partial-Info.plist and include this code:
Portrait
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>
Landscape
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
Then run mvn gluonfx:link again, the final plist will contain these changes.

Expo Info.plist setup for App Transport Security exception

I have a fetch i’m performing on a non https domain. The domain is pre-defined, so i just need to add it to the exception list in the plist, but can’t see how the plist stuff translates to JSON for Expo setup;
It's something like this to allow the non-https domains in XML
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
Expo gives this to add plist config;
"infoPlist": {
...
}
Say for example i wanted to allow http://something.com - how would that translate to the json? I have tried several different setups, all to no avail.

How should I go about adding a Custom URL Scheme to my Info.plist file for firebase phone auth?

This question is in relation to Why firebase phone auth requires a custom URL scheme to be registered in Xcode?
I have tried a couple of things to add Custom URL Scheme to my Info.plist to no luck
I added the following lines to my Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.googleusercontent.apps</string>
<key>CFBundleURLSchemes</key>
<array>
<string>apps.{{CLIENT_ID}}</string>
</array>
</dict>
</array>
EDIT:
Solved the problem by modifying the above lines like this
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.{{CLIENT_ID}}</string>
</array>
</dict>
</array>
Add it in Info > Url Types like so:
More details here:
https://firebase.google.com/docs/auth/ios/phone-auth#set-up-recaptcha-verification

ERROR ITMS-90045: "Invalid Code Signing Entitlements - 'UISupportedInterfaceOrientations'

Im trying to submit my app to the apple store but I am getting a 16 errors after I archive for publishing : This is the first one:
ERROR ITMS-90045: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, key 'UISupportedInterfaceOrientations' in 'Payload/Caregiver.iOS.app/Caregiver.iOS' is not supported."
I dont know where to start to solve this?
The contents of the Info.plist file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Caregiver</string>
<key>CFBundleName</key>
<string>Caregiver</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<key>CFBundleVersion</key>
<string>1.2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleIdentifier</key>
<string>com.wisepill.Caregiver</string>
</dict>
</plist>
In the Info.plist file in iOS project add this line
<key>UISupportedInterfaceOrientations</key>
<array/>
I recreated the provisioning profile and it went through! Clearly, the app store submissions process does not always provide error messages that point to the actual root cause of the issue.

Appcelerator : iOS 10 Apple Push Service not working

I'm working with SDK 5.5.1
I'm trying to send APS in production with my own nodejs server.
Everything is working fine with publishing on device in development state.
I get the device token and the notification is received by the device.
In production, with the same certificate exports (with the production cert and p12), i can get the device token, but not receive the notification.
Does anyone have a solution ?
Here is my tiapp.xml
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>app.test.test</id>
<name>test</name>
<version>1.1.2004</version>
<publisher>Zuhn</publisher>
<url>undefined</url>
<description>undefined</description>
<copyright>2016 by Zuhn</copyright>
<icon>appicon.png</icon>
<fullscreen>false</fullscreen>
<navbar-hidden>false</navbar-hidden>
<analytics>true</analytics>
<guid>mynumber</guid>
<property name="ti.ui.defaultunit" type="string">dp</property>
<property name="run-on-main-thread" type="bool">true</property>
<ios>
<team-id>mynumber</team-id>
<enable-launch-screen-storyboard>false</enable-launch-screen-storyboard>
<use-app-thinning>true</use-app-thinning>
<plist>
<dict>
<key>NSContactsUsageDescription</key>
<string>Can we use to your contacts?</string>
<key>NSCameraUsageDescription</key>
<string>Can we use your camera?</string>
<key>NSCalendarsUsageDescription</key>
<string>Can we use your calendar?</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Can we save to your library?</string>
<key>NSMicrophoneUsageDescription</key>
<string>Can we use your microphone?</string>
<key>aps-environment</key>
<string>production</string>
<!-- Either development or production -->
<key>UISupportedInterfaceOrientations~iphone</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIRequiresPersistentWiFi</key>
<false/>
<key>UIPrerenderedIcon</key>
<false/>
<key>UIStatusBarHidden</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UIBackgroundModes</key>
<array>
<string>voip</string>
</array>
</dict>
</plist>
</ios>
<android xmlns:android="http://schemas.android.com/apk/res/android"/>
<mobileweb>
<precache/>
<splash>
<enabled>true</enabled>
<inline-css-images>true</inline-css-images>
</splash>
<theme>default</theme>
</mobileweb>
<modules/>
<deployment-targets>
<target device="android">true</target>
<target device="ipad">false</target>
<target device="iphone">true</target>
<target device="mobileweb">false</target>
<target device="windows">false</target>
</deployment-targets>
<sdk-version>5.5.1.GA</sdk-version>
<plugins>
<plugin version="1.0">ti.alloy</plugin>
</plugins>
<property name="appc-app-id" type="string">mynumber</property>
It's a breaking change from Apple in Xcode 8. You need to create the entitlements file and place it in /app/platform/ios/.entitlements
Example:
MyApp.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string> <!-- Either development or production -->
</dict>
</plist>

Resources