This question already has answers here:
Publishing issue, Callkit is included even we are not using it
(2 answers)
Closed 5 years ago.
I have an app which enables an user to make phone call to a certain number. I am doing following:-
private void CallContact(string phone)
{
phone = phone.Replace(" ", "");
var callURL = new NSUrl("tel:" + phone);
try
{
if (UIApplication.SharedApplication.CanOpenUrl(callURL))
{
UIApplication.SharedApplication.OpenUrl(callURL);
}
else
{
var av = new UIAlertView("Not supported",
"Calling is not supported on this device",
null,
"OK",
null);
av.Show();
}
}
catch (Exception ex)
{
return;
}
}
This works fine. But when I tried publishing the app, my app got rejected and the Apple team asked me the following:-
We noticed that your app has CallKit and CallKit Blocker enabled:
⁃Which features of your app require CallKit and CallKit Blocker functionality?
⁃Where, specifically, in the app would users access these features?
I am not using the CallKit functionality anywhere in my app. I searched SO and found that it is shipped with the Xamarin.iOS.dll . It is possible that the way I am making calls in my app uses the CallKit?
Sorry for bein a noob :)
try this solution
partial void BtnContactBillingCall_TouchUpInside (UIButton sender)
{
var confirm = new UIAlertView("","Call "+ mobilenumber + " ?",null,"Cancel","Call");
confirm.Show();
confirm.Clicked += (object senderConfirm, UIButtonEventArgs e) =>
{
if(e.ButtonIndex ==0)
{
}
else
{
var url = new Foundation.NSUrl("tel:"+mBillingPhoneNumber);
UIApplication.SharedApplication.OpenUrl(url);
}
};
}
Related
I am trying to implement the in-app purchase inside my Xamarin forms ios application. I have created one in-app purchase product on the app store. I need to do the payment when subscribing the application. I choose Auto-Renewable Subscription as the in-app purchase type.
After that how can I implement that feature on the app side? Do I need to use any Dependency Service for this? Which NuGet package do we need to use, is it Plugin.InAppBilling? I researched this and was confused about the app side integration. Any other setup I need to do to implement this feature.
I am looking for the specific codes that connect the application and the in-app purchase property created on the AppStore.
Only for ios, I am planning to implement the in-app purchase and for android, I am planning to do the payment with stripe. Is google accept stripe payment for this or are they also forced to implement in-app purchases?
Following is my scenario:
The subscription is for the usage of applications from the app/play store. The admin will subscribe to it and all the other users can use it for free.
I tried the below codes from this blog. But it looks likes for the android part, and not mentioned the ios part implementation.
// Connect to the service here
await CrossInAppBilling.Current.ConnectAsync();
// Check if there are pending orders, if so then subscribe
var purchases = await CrossInAppBilling.Current.GetPurchasesAsync(ItemType.InAppPurchase);
if (purchases?.Any(p => p.State == PurchaseState.PaymentPending) ?? false)
{
Plugin.InAppBilling.InAppBillingImplementation.OnAndroidPurchasesUpdated = (billingResult, purchases) =>
{
// decide what you are going to do here with purchases
// probably acknowledge
// probably disconnect
};
}
else
{
await CrossInAppBilling.Current.DisconnectAsync();
}
As per the same blog, I have updated AppDelegate like below:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
//initialize current one.
Plugin.InAppBilling.InAppBillingImplementation.OnShouldAddStorePayment = OnShouldAddStorePayment;
var current = Plugin.InAppBilling.CrossInAppBilling.Current;
return base.FinishedLaunching(app, options);
}
bool OnShouldAddStorePayment(SKPaymentQueue queue, SKPayment payment, SKProduct product)
{
// true in app purchase is initiated, false cancels it.
// you can check if it was already purchased.
return true;
}
On the MainPage, they have added the below code to purchase:
private async void ButtonNonConsumable_Clicked(object sender, EventArgs e)
{
var id = "iaptest";
try
{
await CrossInAppBilling.Current.ConnectAsync();
var purchase = await CrossInAppBilling.Current.PurchaseAsync(id, ItemType.InAppPurchase);
if (purchase == null)
{
await DisplayAlert(string.Empty, "Did not purchase", "OK");
}
else
{
if (!purchase.IsAcknowledged && Device.RuntimePlatform == Device.Android)
await CrossInAppBilling.Current.AcknowledgePurchaseAsync(purchase.PurchaseToken);
await DisplayAlert(string.Empty, "We did it!", "OK");
}
}
catch (Exception ex)
{
await DisplayAlert(string.Empty, "Did not purchase: " + ex.Message, "OK");
Console.WriteLine(ex);
}
finally
{
await CrossInAppBilling.Current.DisconnectAsync();
}
}
On this code they are checking the platform is android: Device.RuntimePlatform == Device.Android. This code is on the portable project, so how I can do the same for ios? And my purchase type is auto renewable subscription, that part is empty on this blog.
private async void ButtonRenewingSub_Clicked(object sender, EventArgs e)
{
}
I am working on Xamarin.Forms app and it's working perfectly fine on Android device. Anyway, when I am trying to run it on iPhone simulator it's just showing the main screen of the app, but none of the features are working.
The main screen consists of two parts of which one is to browse and open files and the other is to open a menu. The layout consists of Browse, process and exit buttons and when I click on the browse button to open file explorer an alert is displayed, that something went wrong.
I enabled breakpoints and tried debugging it, but the control is going to catch exception part directly.
Here is the code for it can anyone please help me with this part? I am using Xamarin.Plugin.Filepicker NuGet package. When I place the cursor on the Exception I can see that
System.NotImplemented Exception:This functionality is not implemented in the portable version of this assembly,you should reference the NuGet Package from your main application project in order to reference the platform specific
and the code is
private Plugin.FilePicker.Abstractions.FileData file =
default(Plugin.FilePicker.Abstractions.FileData);
public async void OnBrowse(object o, EventArgs args)
{
try
{
// var file_path =
this.file = await CrossFilePicker.Current.PickFile();
if (this.file == null)
{
return;
}
string extensionType = this.file.FileName.Substring(
this.file.FileName.LastIndexOf(".",
StringComparison.Ordinal) + 1,
this.file.FileName.Length -
this.file.FileName.LastIndexOf(".", StringComparison.Ordinal) -
1).ToLower();
fileName = this.file.FileName;
if (extensionType.Equals("csv"))
{
csv_file.Text = (fileName);
}
else
{
await this.DisplayAlert("Name of the file:" + file.FileName, "File info", "OK");
}
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Initialize("/storage/emulated/0");
}
}
catch (Exception e)
{
await DisplayAlert("Alert", "Something went wrong", "OK");
if (SettingsPage.loggingEnabled)
{
LogUtilPage.Log(e.Message);
}
}
}
With the new adobe air3.4 APNs are supposed to be built in. However I cant seem to get ios to return a device token. My callbacks are not called.
All the relevant classes are imported. And the app installs and registers notifications as it is supposed to
I have the following code (and i am certain it is executed as i can trace the various objects):
var remoteNotifier:RemoteNotifier = new RemoteNotifier();
try
{
trace("try token");
remoteNotifier.addEventListener(RemoteNotificationEvent.TOKEN, tokenRecieved);
}
catch (err:Error)
{
trace("token error: " + err.message);
}
try
{
trace("try statusevent")
remoteNotifier.addEventListener(StatusEvent.STATUS, subscriptionFailureCallback);
}
catch (err:Error)
{
trace("statusevent error: " + err.message);
}
trace("remote notifier: " + remoteNotifier);
// calling subscribe method without any subscribe options automatically subscribes
// for all notification styles supported on that platform
//CONFIG::DEBUGGING { traceTF("subscribe - notifications"); }
try
{
trace("try subscribe")
remoteNotifier.subscribe();
}
catch (err:Error)
{
trace("subscribe error: " + err.message);
}
Neither the RemoteNotificationEvent or the StatusEvent is called. What to do?
Any help would be greatly appreciated.
You may be missing what kind of notifications you want to subscribe to.
Try adding this:
var preferredStyles:Vector.<String> = new Vector.<String>();
preferredStyles.push(NotificationStyle.ALERT, NotificationStyle.BADGE, NotificationStyle.SOUND);
var subscribeOptions:RemoteNotifierSubscribeOptions = new RemoteNotifierSubscribeOptions();
subscribeOptions.notificationStyles = preferredStyles;
And then when you subscribe you do it with the options:
remoteNotifier.subscribe(subscribeOptions);
It appears that using the itms-apps//.... URL scheme doesn't work in iOS 6 with the new App Store to show the product reviews area. Now I'm using the code below, but it just shows you the product. How do you get to the review area to ask for a review and take the user to the right tab of the product displayed?
void DoReview()
{
var spp = new StoreProductParameters(appId);
var productViewController = new SKStoreProductViewController();
// must set the Finished handler before displaying the view controller
productViewController.Finished += (sender2, err) => {
// Apple's docs says to use this method to close the view controller
this.navigationController.DismissViewController(true, null);
MySettings.AskedForReview = true;
};
productViewController.LoadProduct(spp, (ok, err) => { // ASYNC !!!
if (ok)
{
this.navigationController.PresentViewController(productViewController, true, null);
}
else
{
Console.WriteLine(" failed ");
if (err != null)
Console.WriteLine(" with error " + err);
}
});
}
Hello you could try iRate from Nick Lockwood and see if that fits your needs, you can find the MonoTouch bindings of iRate here.
btw it uses the following URL to open AppStore in review mode:
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id= your-AppID-here
Alex
I am developing one application in that i have contact details ,when i click the contact number it will ask some option like call or sms or add to phone contact. I implemented call and sms, But when am trying to implement add number ,name ,email in to the phone contact am getting struggle. the below code am used for add contact
try
{
ContactList contacts = null;
try {
contacts = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
} catch (PIMException e) {
// An error occurred
return;
}
Contact contact = contacts.createContact();
String[] name = new String[ contacts.stringArraySize( Contact.NAME) ];
name[Contact.NAME_GIVEN] = "Kate";
name[Contact.NAME_FAMILY] = "Turner";
contact.addStringArray(Contact.NAME, Contact.ATTR_NONE,name);
contact.addString(Contact.EMAIL, Contact.ATTR_NONE, emailAddressTo);
contact.addString(Contact.TEL,Contact.ATTR_NONE,"6776787"//this for voice call number.
AddressBookArguments entry = new AddressBookArguments(AddressBookArguments.ARG_NEW, contact);
Invoke.invokeApplication(Invoke.APP_TYPE_ADDRESSBOOK, entry);
}
catch (Throwable t)
{
}
}
This above code work fine but when am trying to add mobile number like this
contact.addString(Contact.ATTR_MOBILE,Contact.ATTR_NONE,"mobile Number");
am getting exception Illegal argument Exception, I don't know how to add the mobile number here,Can anyone help me to solve this?
You can do like this,
if (contacts.isSupportedField(Contact.TEL)) {
contact.addString(Contact.TEL, Contact.ATTR_MOBILE, "1234567890");
}
See this IBM developerWorks article for more info:
Develop mobile apps with Personal Information Management