blackberry - launch wifi setup from application - blackberry

Is it possible to open "manage connections" from app?
My application need to use WLAN. So when it starts i check if wifi is on and connection to network. If it's not connected I would like to open "manage connections" and let user connect. Is it possible?
I was looking at ApplicationManager class but didn't figure out if it's possible.
I uses OS5 api.
Thanks for replies

Yes, it's possible to launch "manage connections" from within your app.
try {
ApplicationManager.getApplicationManager().launch("net_rim_bb_manage_connections");
} catch (ApplicationManagerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
You can find the name of this and similar apps by watching the console while you launch it from the dashboard. Example console output:
Starting net_rim_bb_manage_connections
Started net_rim_bb_manage_connections(198)

Related

Flutter on iOS: How to trigger pop-up for allowing local network access

Is there a way to trigger the pop-up window on an iOS device to allow the connection to other devices on the local network or at least to check the status of the local network permission?
My first idea was to use the permission_handler package for flutter, but this doesn't provide the option for the local network permission.
This may help. The solution that I have is more specific to accessing locally soft access points (soft AP) on an Internet of Things (IoT) type of hardware.
Once I connect the phone to a soft access point, I then make an http.get call to the "soft AP" with http://10.10.0.1/
By making this call, it immediately fails and pops up this dialog that you're referring too.
I forward to generic widget page with an image that's clickable to the iOS Settings.
I used https://pub.dev/packages/app_settings
Upon pressed, I call this code:
AppSettings.openWIFISettings();
It goes to the iOS screen that the user then allows.
Trigger local network permission popup - Working code for Flutter using Socket and IP address of the device itself:
import 'package:network_info_plus/network_info_plus.dart';
import 'dart:io';
try{
var deviceIp = await NetworkInfo().getWifiIP();
Duration? timeOutDuration = Duration(milliseconds: 100);
await Socket.connect(deviceIp, 80, timeout: timeOutDuration);
} catch (e) {
print(
'Exception..');
}

Android - How to relaunch an app in background without restarting it?

I want to open an app and then navigate to settings and comeback to app and continue from the place were i left.
Tried using noReset and fullReset but nthgn worked.
You can relaunch app with using any page (Splash screen in below example) activity of Application from where you want to open app.
public static void launchActivity(Activity activityName)
{
((AndroidDriver<MobileElement>) driver).startActivity(activityName);
}
How you can call this function
Suppose you have below app package and activity (its for example but you have to use for your app)
String appPackage ="my.app.helloworld";
String appActivity = "my.app.helloworld".common.activity.SplashScreen";
launchActivity(new Activity(appPackage, appActivity));
You can use .launchApp(); to come back the previous apps and activity.
driver.launchApp();
use driver.activateApp(app_bundleId); to get back to previous state of the app.

NEHotspotConfigurationManager unable to Join

I am using NEHotspotConfigurationManager to connect wifi programmatically.
Its an open Network without any password
I am using below code:
if (#available(iOS 11.0, *)) {
NEHotspotConfiguration *config = [[NEHotspotConfiguration
alloc]initWithSSID:SSIDName];
[NEHotspotConfigurationManager.sharedManager applyConfiguration:config completionHandler:^(NSError* error) {
if (error) {
printf([error description]);
}
else
{
printf(#"success");
}
}];
I am connecting to the hostpot/access point of one device, but every time I am getting an error of unable to join but in response it goes to success as the error is nil. Is there any thing I need to add in configuration or add in setting or am I missing anything ?
PS: The wifi is of IOT device
-Thanks in advance
This is an Apple bug in iOS.
Once the request has made it past the Network Extension framework, down to the Wi-Fi subsystem, errors are displayed to the user rather than delivered to your completion handler.
see https://forums.developer.apple.com/thread/96834
What you can do as a workaround:
try to connect
if the error is nil, you may be connected (due to the above mentioned bug this is unclear)
then check which network you are connected to
For more information, including sample code, see my answer here: https://stackoverflow.com/a/56589229/2331445
Additional Hints
Entitlement
Like #zero3nna already mentioned in the comments, the Hotspot Configuration entitlement must be added.
Check SSID name
Make sure you spelled the SSID correctly. I made a test with a NanoESP IoT device and for my device the definition would look like this:
NSString *SSIDName = #"NanoESP";
If you are using a non-existent SSID name (e.g. NanoESP2), there is a dialog that says that it is not possible to join the network.
Due to the above mentioned error you will get a success message in the console of Xcode, which is of course wrong:
Delayed Wi-Fi indicator
I have noticed that using the correct SSID works, but it takes quite some time for this connection to my specific IoT device to appear with the typical icon in the iOS status bar. For some time it's just not shown, see screenshot. To check the status anyway, go to iOS Settings / Wi-Fi:

iOS 10 - WLAN Access Setting Doesn't Appear In Some iOS Devices

Our app is using WLAN to communicate with a wireless device. When our app is installed in iOS 10. Sometimes, udp socket doesn't work. The reason for that is, in iOS 10 they added a new setting or permission under your app that allows the user to switch on or off the user of WLAN or cellular data.
The following would appear in the settings of the app:
When I tap on the Wireless... It will bring me to this UI:
After allowing WLAN use. The app would work fine.
Now, the problem is, sometimes, or in some devices running iOS 10, the settings that I just showed you doesn't appear(I am referring to the setting shown on the first image). So, is there anything I can do to make that settings always appear? It seems that sometimes iOS system doesn't recognize that my app is using wireless data. And it would result in my app would never get to use WLAN forever.
There is no user permission to use WIFI in iOS10.
The application in your screenshot (BSW SMART KIT) is using Wireless Accessories (WAC), i.e. is able to connect to wireless speakers. To accomplish this the Wireless Accessory Configuration capability is required. This is what you can dis/enable in the systems settings (your screenshot).
The switch in the settings shows up after connecting to a device via WIFI through WAC. You can see this behaviour in your sample app (BSW SMART KIT) too.
This sample code might let you get the idea. Detailed information in Apples documentation.
After a time of researching. I ended up seeking help with Apple Code Level Support. Apple states that this problem would most probably occur when you reskin your app. They say that probably it's because of the Image UUID of the main app and the reskinned app are the same. When you install both of them in your phone, the system will treat the reskinned app as the same app compared to the main app. So, if the one app fails to access WLAN, then it will also affect the other one. According to them, this appears to be a bug in iOS. And currently, they don't have any solution for the developers. This is the radar bug number:
What I did to somehow lessen the occurrence of the problem is to add tracking to the Network Restriction by using the following code.
- (void)startCheckingNetworkRestriction
{
__weak AppDelegate *weakSelf = self;
_monitor = [[CTCellularData alloc] init];
_monitor.cellularDataRestrictionDidUpdateNotifier = ^(CTCellularDataRestrictedState state)
{
[[NSOperationQueue mainQueue] addOperationWithBlock:^
{
NSString * statusStr;
switch(state)
{
case kCTCellularDataRestrictedStateUnknown:
{
statusStr = #"restriction status:Unknown";
}
break;
case kCTCellularDataRestricted:
{
statusStr = #"restriction status:restricted";
[weakSelf performUrlSession];
}
break;
case kCTCellularDataNotRestricted:
{
statusStr = #"restriction status:not restricted";
}
break;
default:
{
abort();
}
break;
}
NSLog(#"Restriction state: %#", statusStr);
}];
};
}
Take note that you have to import CoreTelephony to do this.
#import CoreTelephony;
when I detect that the network is restricted. I will open a URL session to force internet access attempt and would hope that the restriction alert dialog would pop out. Once the alert is pop out, then the WLAN Access Settings that I was talking about would definitely appear under the settings. There are times that this doesn't work. If it happens, then you'll just have to rename the bundle ID, and make a couple of changes to your code and then rebuild it a couple of times (Well, that's what I did when I was experimenting this). Reinstalling the app won't do a thing. Restarting and resetting the phone won't do either.
Hope this helps.

How long does it take to change the status from connecting to open using twilio device connection?

How long does it take to change the status from connecting to open using twilio device connection?
Since I see inconsistencies in connection and the connection remains in connecting status for a few and does not transition to open state requiring action to manually close the connection and restart again.
Satej, Megan from Twilio here.
There are a number of possible reasons for these inconsistencies. Among them are microphone access, browser settings and versions, or access to your token (i.e. it's expired). But there are also updates coming to version 1.3 of the Twilio.js library that could help isolate these issues.
In the meantime, be sure to put some status callback error handlers in place and include explicit code to disconnect the device and .disconnectAll().
Twilio.Device.error(function (error) {
$("#log").text("Error: " + error.message);
});
...
Twilio.Device.disconnect(function (conn) {
$("#log").text("Call ended");
});
function hangup() {
Twilio.Device.disconnectAll();
}

Resources