I am trying to build a payment appication on BlackBerry jde version 5.0.0.14. When I debug the code, PaymentEngine object is always null. Why does this happen? Is there any fault in my code?
private PaymentEngine engine = PaymentEngine.getInstance();
public PurchaseDemoScreen()
{
setTitle("Payment Service SDK Demo");
if (engine != null)
{
engine.setConnectionMode(PaymentEngine.CONNECTION_MODE_LOCAL);
//do shopping
}
else
{
//in-app purchase unavilable
}
}
What version of the BlackBerry App World do you have installed?
PaymentEngine.getInstance()
does return null if the BlackBerry device does not have BlackBerry App World 2.1 or higher installed.
Related
Now I am deveoping in app purchase in iOS using flutter, but the in app purchase did not support debugging on simulator, so I have to package my app and install in real device and test in app purchase, but the problem is the package take me so much time. And I could not see the log and code workflow so I did not know where is going wrong. So I have to tweak my code and package the apk file(the ci may take me hours) again and again. It make me crazy, is it possible to show the log or let me debbuging in simulator when develop in app purchase in iOS?
how to see the log? I write a rest api and send log info to the server side.
static Future<void> logger(String restLog) async {
RestLogModel restLogModel = RestLogModel();
restLogModel.message = restLog;
Map jsonMap = restLogModel.toMap();
try {
final response = await RestClient.postHttp( "/post/logger/v1/log", jsonMap);
if (response.statusCode == 200 &&
response.data["statusCode"] == "200") {
Map channelResult = response.data["result"];
if (channelResult != null) {
// Pay attention: channelResult would be null sometimes
String jsonContent = JsonEncoder().convert(channelResult);
}
} else {
AppLogHandler.logError(RestApiError('Item failed to fetch.'),
JsonEncoder().convert(response));
}
} on Exception catch (e) {
}
}
It works fine. But every time I change the code, I have to repackage the code and install in real device to verify the change, is there anyway to make it easy? like debugging in app purchase in an emulator?
You can use OS Logs to capture the log statements in the MAC Console app and filter the logs by your category
import os.log
extension OSLog {
private static var subsystem = Bundle.main.bundleIdentifier!
/// Logs the view cycles like viewDidLoad.
static let viewCycle = OSLog(subsystem: subsystem, category: "viewcycle") }
Below is my ICloudService
public class AzureCloudService : ICloudService
{
MobileServiceClient client;
public AzureCloudService()
{
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
client = new MobileServiceClient("https://xxxxxxxxxxxxxx.azurewebsites.net");
}
public ICloudTable<T> GetTable<T>() where T : TableData
{
return new AzureCloudTable<T>(client);
}
}
If i remove the 'client = new' line the application is loaded else it throws below error.
Vizualization Error
No body on method
Microsoft.WindowsAzure.MobileServices.IApplicationStorage
Microsoft.WindowsAzure.MobileServices.IPlatform::get_ApplicationStorage() (NInterpretException)
I've also got the same problem using my iPhone 6 with Live Player.
If I hook Visual Studio up to my Mac and run it through the iPhone simulator in Visual Studio then it works OK, so presumably, it's something wrong with Live Player?
I wrote a code to get the location coordinates using cellsite based location and here is the code i used:
Criteria criteria = new Criteria();
criteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
criteria.setCostAllowed(true);
criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
try {
LocationProvider lp=LocationProvider.getInstance(criteria);
if(lp !=null)
{
Location loc=null;
loc=lp.getLocation(-1);
if(loc!=null)
add(new EditField(loc.getQualifiedCoordinates().getLatitude()+"\n"+loc.getQualifiedCoordinates().getLongitude(),""));
else
add(new EditField("no location found",""));
}
else
{
add(new EditField("unable to find the location provider", ""));
}
} catch (LocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I used Blackberry 8520 mobile with airtel sim card with version 5.0 and it worked perfectly. I got the coordinates and it is fine. Now i used the same application with same sim card with Blackberry 8520 version 4.6.1. When i start the application, it is starting but it is not displaying even the main screen. This is the output when i run the app in 5.0 mobile:
and when i run this in 4.6 i didn't get any screen atleast showing error message. Please provide a solution. Thank you. To clarify further i installed google maps on 4.6 mobile with the same sim card and it showed me the correct location and also there is also no problem in accessing the internet
Did you compile the app against a version 5 compiler? If yes then your app wont start in os4.6 device. You have to compile in atleast 4.6 jde compiler to get your app working.
I'm working on a BlackBerry application that uses a MapView.
At the moment, I'm only showing the MapView, nothing more.
This is a snippet from the code I use for it:
public class MapScreen extends MainScreen {
private MapField map;
public MapScreen() {
super(MainScreen.NO_VERTICAL_SCROLL);
map = new MapField();
map.moveTo(new Coordinates(50.847573,4.713135, 0));
add(map);
//...
}
//...
}
I'm using net.rim.device.api.lbs.MapField because I have to be compatible with OS 5.0
On the simulator, everything's fine and it's working.
But the moment I deploy it on the device, I see a white screen...
The device has an internet connection, but only over Wi-Fi. First I was thinking that that was the problem, but according to "Blackberry services that are available over Wi-Fi connections", it shouldn't be a problem.
So, does anybody know why it's not working on the device, and how I can solve this?
Thanks
You say "the device has an internet connection, but only over Wi-Fi" which makes me beleive you don't have the real device provisioned with a BlackBerry data plan. You need that plan in order to access any BlackBerry services, even over Wi-Fi.
To check for an appropriate connection you can use:
if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_BIS_B) {
// Connection will support BlackBerry services
} else if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS) {
// Connection will support BlackBerry services if BES allows the connection to BIS servers.
}
A better way of checking for this is to check the ServiceBook entries for LBSConfig or variants thereof.
That allows devices that are no longer on a plan, but were once configured by one with LBS, to function properly.
private static final boolean have_lbs() {
ServiceBook sb = ServiceBook.getSB();
ServiceRecord[] records = sb.getRecords();
int count = records.length;
for (int ii = 0; ii < count; ++ii) {
if (records[ii].getCid().toUpperCase().startsWith("LBS"))
return true;
}
return false;
}
I want to know what API can check if "BlackBerry maps" is installed on a device.
I have a BlackBerry application, and I want to call "BlackBerry maps" from this application, or throw an error if "BlackBerry maps" hasn't been installed yet.
Above OS 6.0 you need to check for another code module
int mh1 = CodeModuleManager.getModuleHandle("net_rim_bb_lbs"); // OS 4.5 - 5.0
int mh2 = CodeModuleManager.getModuleHandle("net_rim_bb_maps"); // OS 6.0
if (mh1 == 0 && mh2 == 0) {
Dialog.alert("BlackBerry Maps not installed");
}
You can use this
m_bbHandle = CodeModuleManager.getModuleHandle("net_rim_bb_lbs");
if m_bbHandle > 0 then the module is installed.
net_rim_bb_lbs is BlackBerry Maps.
Here is the link to the doc