How to get ISO CountryCode , Country Code programmatically in blackberry? - blackberry

Is there any way to retreive the ISO Country Code/Country programmatically in Blackberry 5.0/6/0 devices

You can obtain the country from the mobile network (if a SIM card is present). This is called Mobile Country Code. It is a number that you can then map to a string. In the API you have GPRSInfo.getHomeMCC. You can also call RadioInfo.getMCC and even RadioInfo.getNetworkCountryCode, that will already return the text if the carrier supports it.
And to get the ISO code of the device language, you can call Locale.getDefaultForSystem().getCountry().

Related

What controls user locale when performing handover to phone

I'm currently working on an action using the Actions on Google SDK together with Microsoft's Bot Framework. In this action I've build a fallback that allows the user to enter a product code on their phone if they have failed to do so a couple times through voice. This setup works fine in English, but my action is multi-lingual and supports Dutch and French too.
The problem that I am running into is, when a user is using my action in Dutch or French, when they accept to move the conversation to their phone, the conversation continues in English once it is on my phone. Below you can find an the code I use in my handler.
New Surface handler
endpoint.intent(GoogleIntentTypes.NewSurface, async (conv: ActionsSdkConversation) => {
logger.logDebug("Received new surface request")
const locale = conv.user.locale;
if (conv.arguments!.get('NEW_SURFACE')!.status! === 'OK') {
conv.ask(this.messages.getResponse("AskForProductNumber_SSML", locale));
} else {
conv.close(this.messages.getResponse("EndConversation_SSML", locale));
};
});
From the moment the request enters my webhook, my conversations locale is switched to en-US. This makes me think that the locale is taken from a setting on my phone, but I can't find anything in the docs on this. Does anyone know what could be causing the switch in locale when performing a handover to phone?
My understanding is that the locale is based on the locale of the device that has sent the request.
This page on "languages and locales" (emphasis mine) says:
Locales are constructed using the language set in the Assistant settings and the region set in the device settings. The combination of these needs to form a supported locale. For example, a device set to the BR region and an Assistant device set to en-US results in a en-BR locale, which is not supported by Actions on Google.

Making phone call in Australian app ios

I am currently running into an issue with Xamarin Studio and making phone calls.
I am having an issue when trying to make a call to an Australian phone number from an app that is only available in the Australian app store. I am using
UIApplication.SharedApplication.OpenUrl(new NSUrl(tel:{phoneNumber}))
but it is showing that there is nothing found that can handle the phone number. The number is in a format such as: XXXXXXXXXX. I looked over Apple's documentation about Phone links, but it only shows how to setup the format for phone numbers located in the US. I am located in the US and published the app under their account. Do I need to include the country code? or is there something else that I am missing entirely?
I know the above code is deprecated in iOS10. I am mainly concerned with why the number is not working.
Thanks for your help.
You can include the country code (+61 for Australia country code) in the phone number directly like below:
UIApplication.SharedApplication.OpenUrl(new NSUrl("tel:" + "+61123456789"));
From your example:
UIApplication.SharedApplication.OpenUrl(new NSUrl(tel:{phoneNumber}));
I assume that your phoneNumber is a parameter.
So maybe you should use:
UIApplication.SharedApplication.OpenUrl(new NSUrl("tel:" + phoneNumber));
This is a Xamarin Phone call example.

App with custom URL callback and custom search URL

I'm looking for recommendations for an iOS barcode scanner app. Specifically for iPad which will support a custom URL callback to enable the app to be launched from a web browser.
Additionally, it needs to support and a custom search URL which will send the user back to the website once the barcode has been decoded into a URN (SKU).
I have discovered ZBar which is an excellent app, unfortunately it doesn't support custom URL callback and it's designed for the iPhone.
Another app pic2shop PRO seems to tick these boxes, but it's relatively expensive at £10.49 and the setup will require somewhere in the region of 200 installs.
I did a similar project using the free version of pic2shop . The thing is that the free version can read only these types of barcodes : UPC-A, UPC-E, EAN-13, EAN-8 , according to the documentation of the app.
Pic2shop is a free barcode scanner app available for iOS® and Android®. It reads UPC-A, UPC-E, EAN-13, EAN-8 and QR codes. The app also display comparison shopping results for UPC and EAN.
From my personal experience, I can say that it scans and decodes the barcode very fast and very accurate.
In my project the app is launched from a webpage, it works for both android and ios. In order to get it working you have to invoke the pic2shop app from a url and then set your callback address. You will find the decoded barcode data as a value to a parameter in the callback url. To help you more, you can get those values using this javascript function found here.
For example:
<input type=button OnClick="scan();" value="Scan Barcode">
<script>
function scan(){
window.location="pic2shop://scan?callback=http://yourwebsiteurl.com/index.html?barcode=ean"
}
</script>
As soon as the item is successfully scanned it will redirect you to the callback url with the actual barcode number as a value to a parameter. For example http://yourwebsiteurl.com/index.html?barcode=5123548745123. I already told you how to get the value of a url parameter with javascript.
PDF417.mobi Pro barcode scanner app supports that use case.
Note: I'm a developer on that project.
Basically, the app can be launched from any other app, including a web application, when url in the form: pdf417://scan?type=PDF417,UPCA&callback=myscheme://myaction is launched.
The app then scans the barcode, in multiple formats, (PDF417 and UPCA in this example), until the result is obtained.
Then, the app opens the URL myscheme://myaction. In your case, this can be your web service, http://www.somemyscanner.com/service.
Specifically, it will open the URL using format: http://www.somemyscanner.com/service?data=[data]&type=[type].
You can then use those parameters to implement your desired functionalities.
I tried the PDF417 app and it is EXTREMELY expensive (for an app - $28) and does not work. I bought it anyway because I am trying to solve the same issue and I can tell you it is not the solution for general barcode scanning.
It might work with pdf417 barcodes, but those are few and far between and I haven't been able to get it to work. I definately does not support any standard barcode formats. It also has no settings panel (in settings) and the tap target in the app that should be settings just take you to the company web site.
I am still testing other apps but haven't found any app that does what you ask, Red Laser used to but it no longer has that functionality.

send text code phonegap ios

I need to add a "share this app via text" button to my app. I am currently using Phonegap 3.3. I use this code
share via text
This works fine for Android, but on iOS devices it doesn't pass the subject or actual content of the message though.
No, it is not possible.
The sms scheme is used to launch the Messages app. The format for URLs
of this type is “sms:”, where is an optional parameter that specifies
the target phone number of the SMS message. This parameter can contain
the digits 0 through 9 and the plus (+), hyphen (-), and period (.)
characters. The URL string must not include any message text or other
information.
Answer was taken from this Link.
It is possible, if you make a phonegap plugin that in turn uses this Native API to get the result you are looking for:
Here's a tutorial that helps too:
http://iosdevelopertips.com/core-services/how-to-send-an-sms-progammatically.html

How Can I check programmatically app store region/country?

Is there a way to check it?
I have an application URL, which I don't want to be opened expect if the user have a uk appstore. unfortunately, this application is available in many country, so when I put 'gb' on the link, it be redirected to the local region of the user.
For iOS 13+, check the SKStoreFront class. It has a countryCode that returns the country code belonging to the user's current App Store region.
Swift
if let storefront = SKPaymentQueue.default().storefront {
print(storefront.countryCode) // Returns an Alpha-3 country code (USA, GBR etc.)
}
Obj C
[SKPaymentQueue defaultQueue].storefront.countryCode; // Returns an Alpha-3 country code (USA, GBR etc.)
You should be able to access the SKStoreFront instance by adding the StoreKit framework to your project, even if your app does not offer any purchases.
For more information, check out: https://developer.apple.com/documentation/storekit/skstorefront
You could use the in-app purchase Store Kit to achieve this.
Request the product list using SKProductsRequest then check the returned SKProduct's priceLocale to see if the user's AppStore is the UK one.

Resources