Recently I added Broadcast Upload Extension to Xamarin.Forms project however I can't find a way how to invoke the extension and present it to the user from the container app.
How would I invoke the extension and present it to the user? Through OpenUrl and it's bundle identifier?
Needs to be invoked like this:
var bundle = NSBundle.MainBundle.GetUrlForResource("Foo.iOS.ScreenShareExtensionUI", "appex", "PlugIns");
RPScreenRecorder.SharedRecorder.StartRecording(true, error =>
{
if (error != null)
LogService.Log(error.LocalizedFailureReason, LogService.LogLevel.ERROR, "StartRecording");
});
RPBroadcastActivityViewController.LoadBroadcastActivityViewController(bundle.AbsoluteUrl.ToString(), (controller, error) =>
{
UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(controller, true, null);
RPBroadcastActivityViewController = controller;
});
I think this is repeated somehow here
You need to double-check the NSExtension key.
The value of the NSExtensionPointIdentifier for BroadcastUploadExtension project is written as com.apple.broadcast-services by default
and should be com.apple.broadcast-services-upload
The value of the NSExtensionPointIdentifier for BroadcastUIExtension project is written as com.apple.broadcast-services by default
and should be com.apple.broadcast-services-setupui
Refrence
Related
I used to have deep linking working on Xamarin.iOS with this delegate:
[Register("MyApp.iOS.PushService")]
public class PushService : UAPushNotificationDelegate
{
public override void ReceivedNotificationResponse(UNNotificationResponse notificationResponse, Action completionHandler)
{
try
{
NSString key = new NSString("^d");
if (notificationResponse.Notification.ValueForKey(key) != null)
{
PushClient.HandleNotificationOpened(notificationResponse.Notification.ValueForKey(key).ToString());
}
}
catch (Exception ex)
{
}
completionHandler();
}
}
I was receiving deep link actions to Airship when someone tapped on a push notification... I would pass this into "PushClient" to handle the deep link. (It seemed like Airship used to pass this with field "^d" for some reason, so I just used that and it worked for a long time)
Recently this no longer works, so I'm wondering if this Delegate/Handler is no longer viable? How can I see the whole payload of the push notification now, and/or see the values I tried to pass over from a deep link?
I used to have a .apns file of JSON I'd drag onto an iOS Simulator to mock a deep link push notification but I've lost it. No matter what I put in the .apns file, this delegate function of mine doesn't see any custom keys, either.
I'm trying to register a second firebase application in my app. The first one is correctly registered inside didFinishWithLaunchingWithOptions method (by default is using the GoogleService-Info.plist)
FirebaseApp.configure()
Then I need to retrieve a new googleAppId from a server and configure a new application using this new googleAppId and using my iOSID of curse. I am doing all this registration inside AppDelegate. I'm registering this way:
let options = FirebaseOptions(googleAppID: String(format: "1:%a:ios:%a", googleID, iOSID), gcmSenderID: googleID)
//Deleting the first app in order to register the second
let app = FirebaseApp.app()
app?.delete { _ in }
FirebaseApp.configure(options: options)
It was working well until I update my firebase version from 6.2 to 6.19, now the app is crashing in FirebaseApp.configure(options: options)
The log says:
Terminating app due to uncaught exception 'com.firebase.installations', reason
'[Firebase/Installations][I-FIS008000] Could not confiure Firebase Installations die to invalid
Firebase options. The following parameters are nil or empty: `FirebaseOptions.APIKEY`. If you
use GoogleServices-Info.plist please download the most recent version from the Firebase Console.
If you configure Firebase in code, please make sure you specify all required paramaters.
Is worth mencioning that a new Framework was added to Analytics in Firebase version 6.15 so I had to added it in order to make my app compile again.
I also tried to add a new parameter inside the FirebaseOptions but is still asking for the same parameters, it is not expecting an APIKEY which i don't know where to get it
The message comes from here as far as I can see. The check done there shows that these three values must always be specified:
if (appName.length < 1) {
[missingFields addObject:#"`FirebaseApp.name`"];
}
if (appOptions.APIKey.length < 1) {
[missingFields addObject:#"`FirebaseOptions.APIKey`"];
}
if (appOptions.googleAppID.length < 1) {
[missingFields addObject:#"`FirebaseOptions.googleAppID`"];
}
From the error message and your code it looks like you're not specifying the APIKEY in your FirebaseOptions, which is required according to the SDK.
Wondering if someone could help me with this, or at least point me in the right direction.
I've been searching for documentation on how to get/set settings in a React Native iOS app so that those settings appear in the iOS Settings app listed under my app. I see that there is a Settings API, but it appears that the documentation is not complete. The function definitions are listed there, but that's it. No examples or anything.
Can anyone provide me with a simple example, or point me to a tutorial or something that will help me get going? I'm assuming I import Settings from react-native, just like I would do for other APIs, but beyond that I'm not sure where to go.
Thanks.
As stated in React Native documentation :
Settings serves as a wrapper for NSUserDefaults, a persistent
key-value store available only on iOS.
If you want to add iOS Settings bundle to your app you can use this.
As per Chris Sheffield's comment, here is what I have succeeded with so far:
Add a Settings.bundle to your Xcode project
Highlight the project > File > New > File
Choose "Settings Bundle" > Next
I just left the default name: Settings.bundle
Open the Root.plist file inside of the bundle
Make changes based on Apple's documentation (version I'm referencing is archived here: https://web.archive.org/...)
The important value to keep track of is the item's Identifier
Save, compile, and install the app
You can now use Settings.get('<identifier>') like either of these:
const varName = Settings.get('var_name')
const [ varName ] = useState(Settings.get('var_name'));
Notes
I suggest using some method of watching for changes so that your app updates when the user changes settings while it's running, but these are the only parts required.
I do not suggest letting the user also change those specific settings in-app since that goes against the principle of Single Source of Truth, but it's your app, you do what's best for you and your users.
Hope this plugin will help. react-native-permissions
export const _checkPermission = (permissionName) => {
return Permissions.check(permissionName).then(response => {
if (response === 'denied') {
return false
} else if (response === 'authorized') {
return true
} else if (response === 'restricted') {
return false
} else if (response === 'undetermined') {
return false
}
})
}
also, you can use this for asking permission
_requestPermission = (permissionName) => {
return Permissions.request(permissionName).then(response => {
return response
})
}
export const _alertForPermission = (permissionName) => {
return _requestPermission(permissionName)
}
I wanna know which app calls the share extension to share image to my app(its bundleId or appName). But I found no way to do it. There is none information about the source app in NSExtensionContext. I would greatly appreciate any help.
To achieve what you're asking:
#ifdef HIDE_POST_DIALOG
- ( void ) willMoveToParentViewController: ( UIViewController * ) parent
{
// This is called at the point where the Post dialog is about to be shown.
NSString * hostBundleID = [parent valueForKey:(#"_hostBundleID")];
NSLog( #"**** parent bundle id is %#" ,hostBundleID);
}
#endif
You don't get to find out what app is hosting your extension. That's not part of the extension system. You get to find out what kind of data the app is passing you and, with action extensions, you get to return some data. But you don't get to find out who you're dealing with, only what data is going back and forth.
Your bundle ID is usually com.yourcompany/yourname.yourappname
If you don't know what Xcode has for your company name, create a new project and the screen that prompts you for your app name will have your company name.
Also you can do this,
In Xcode, select your project, then your target (you should have only one) and then the 'Info' tab. You should be able to see the bundle identifier there.
The answer to this question can be found here:
How to get bundle ID?
I am working on extension for safari.I have checked we can communicate between host app and extension as we can run extension or close extension.But in my case I want to communicate with host app without closing extension app.
var MyExtensionJavaScriptClass = function() {};
MyExtensionJavaScriptClass.prototype = {
run: function(arguments) {
arguments.completionFunction({"baseURI": document.documentElement.innerHTML});
},
test: function(arguments) {
alert("Need to run without closing extension");
},
finalize: function(arguments) {
alert("Test Done");
// arguments contains the value the extension provides in [NSExtensionContext completeRequestReturningItems:expirationHandler:completion:].
// In this example, the extension provides a color as a returning item.
document.body.style.backgroundColor = arguments["bgColor"];
}
};
var ExtensionPreprocessingJS = new MyExtensionJavaScriptClass;
In above my JavaScript file I have run function that run at the time of extension run and finalize fun run as we call completeRequestReturningItems in objc side.I want to run my test function without closing extension
You don't.
To quote Apple's Extension Guidelines, from the section How an Extension Communicates.
There is no direct communication between a running extension and its containing app; typically, the containing app isn’t even running while its extension is running.
This isn't to say that you cannot, just that Apple doesn't want you, and the ability to do so is probably either private or non-existent.
Quick terminology level set:
Containing App = "an app that contains one or more extensions is called a containing app"
Host App = "An app that can let users choose an extension to help them perform a task is called a host app."
That being said, Apple does not supply a communication stream from Host App to extension. In your case, you can load data initially with the run() in the JS Preprocessing file and then respond with data on exit of the extension with finalize().