How use "android.net.wifi.NetworkSpecifier.Builder" with jnius? - kivy

The issue is:
I was using "android.net.wifi.WifiConfiguration" for connecting to WIFI like this:
Correctly Working.
from jnius import autoclass
ssid = str("ssid_name")
print("app says-->connecting to wifi:",ssid)
String = autoclass('java.lang.String')
WifiConfigure = autoclass('android.net.wifi.WifiConfiguration')
PythonActivity = autoclass('org.kivy.android.PythonActivity')
activity = PythonActivity.mActivity
service = activity.getSystemService("wifi")
WifiManager = autoclass('android.net.wifi.WifiManager')
WifiConfig = WifiConfigure()
> # # # #
Connectname = String(ssid)
connectkey = String("Wifi Password")
WifiConfig.SSID = "\""+Connectname.toString()+"\""
WifiConfig.hiddenSSID = True
WifiConfig.preSharedKey ="\""+ connectkey.toString()+"\""
added = WifiManager.addNetwork(WifiConfig)
WifiManager.enableNetwork(added, True)`
But after API 29 that java library is deprecated, and I need to deploy on Play Store the Android App Bundle with at least API 30.
So:
On site https://developer.android.com they speaking about use "android.net.wifi.NetworkSpecifier.Builder" instead of "android.net.wifi.WifiConfiguration", is there anyone to tell me how to use integrate with jnius and autoclass?
I expect python programmers to help me solve the problem

You cannot programmatically connect to Wi-Fi after API 30.

Related

firebase dynamic link error on IOS "Deep Link does not contain valid required params"

My app is an ionic app and i use cordova-plugin-firebase-dynamiclinks it works on android
but on ios i get this error:
6.19.0 - [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
"_cpb" = 1;
"_cpt" = cpit;
"_fpb" = "CJsFEPcCGgJlbg==";
"_iumchkactval" = 0;
"_iumenbl" = 1;
"_osl" = "https://khanoo.page.link/test2";
"_plt" = 1260;
"_uit" = 2887;
apn = "com.codex.khanoo";
cid = 7661467918835935158;
ibi = "codex.khanoo";
isi = 1446149404;
link = "https://khanoo.com/tabs/estates/id/6155?page=estate&pageId=198";
sd = "very nice";
si = "https://khanoo.com/backend/thumbnails/estates/5e6a9552807f4/0-5e6a95528082e.jpeg";
st = house;
}
my Bundle ID is codex.khanoo and i added it to info url type url schemes i also added GoogleService-info.plist
and also in firebase console i added everything Bundle ID , App Store ID
and Team ID
I faced this problem myself before, been looking for solution for days, turns out my link is not properly encoded, so make sure this link is encoded properly
link = "https://khanoo.com/tabs/estates/id/6155?page=estate&pageId=198";
In PHP you can use urlencode(YOUR_LINK) https://www.php.net/manual/en/function.urlencode.php
In Ruby you can use ERB::Util.url_encode(YOUR_LINK)

Offlineimap stops retrieving after first 20-30 messages

I have been trying to set up offlineimap to sync mail from gmail to the local folders on my mac machine.
The issue with my current set-up is that, offlineimap will start to sync the mail from both accounts, I can see lines like -
Copy message 3 (3 of 10966) repo1_remote:[Gmail]/Important -> repo1_local
But, after around 20-30 copy message, these lines just stop. Offlineimap is still connected though, it refreshes after 10 minutes and syncs again but, I cant see any more copy message lines in the repos any longer, it just stops. I can see these new 20-30 new messages in mutt, but not more. Killing and restarting offlineimap agains copies 20-30 new messages and again stops. I have no clue as to what is wrong. I guess it should copy all messages locally. Here is my offlineimaprc. I have the python file set up correctly.
[general]
metadata = ~/.offlineimap
accounts = repo1, repo2
maxsyncaccounts = 10
#ui = blinkenlights
ui = ttyui
pythonfile = ~/Development/OfflineIMAP/mail/offlineimap.py
#socktimeout = 60
[mbnames]
[Account repo2]
localrepository = repo2_local
remoterepository = repo2_remote
autorefresh = 10
status_backend = sqlite
synclabels = yes
[Account repo1]
localrepository = repo1_local
remoterepository = repo1_remote
autorefresh = 10
status_backend = sqlite
synclabels = yes
[Repository repo2_local]
type = GmailMaildir
nametrans = get_remote_name
localfolders = ~/Development/OfflineIMAP/mail/repo2
sep = /
restoreatime = yes
[Repository repo1_local]
type = GmailMaildir
nametrans = get_remote_name
localfolders = ~/Development/OfflineIMAP/mail/repo1
sep = /
restoreatime = yes
[Repository repo2_remote]
type = Gmail
folderfilter = is_included
nametrans = get_local_name
cert_fingerprint = 3ffdb8519c1c8242ce8387d3d9fccc208a776b4a
remoteuser = asd#gmail.com
remotepasseval = get_password('asd')
usecompression = yes
maxconnections = 3
[Repository repo1_remote]
type = Gmail
folderfilter = is_included
nametrans = get_local_name
cert_fingerprint = 3ffdb8519c1c8242ce8387d3d9fccc208a776b4a
remoteuser = qwe#gmail.com
remotepasseval = get_password('qwe')
usecompression = yes
maxconnections = 3
I would like to know what is preventing offlineimap from copying further messages and what should I change in the config to make it work properly.
I've just recently ran into the same problem with gmail. In my case disabling compression and setting connections limit to 1 resolved the issue (didn't have time to investigate fully). Have you tried doing this?

Send all traffic over VPN connection Swift

I am creating an application to connect to a VPN server. I have worked out how to do this, but need to be able to send all traffic over the connection. Is there any code which can do this? So far I have tried:
let manager: NEVPNManager = NEVPNManager.sharedManager()
var p = NEVPNProtocolIPSec()
manager.`protocol` = p
let pw = ""
p.username = ""
p.passwordReference = pw.dataUsingEncoding(NSUTF8StringEncoding)
p.serverAddress = ""
p.authenticationMethod = NEVPNIKEAuthenticationMethod.SharedSecret
//p.sharedSecretReference = getPasscodeNSData("vpnSharedSecret")
p.useExtendedAuthentication = true
p.disconnectOnSleep = false
From Apple:
This is the default routing method. The IP routes are specified by the
Packet Tunnel Provider extension at the time that the VPN tunnel is
fully established. See NETunnelProvider for more details.
This is something the is specified from the Server end typically, l2tp does allow the user to toggle this setting. For that, take a look at routingMethod part of the NETunnelProvider. Scroll down to the Routing Network Data to the VPN section for the information you are looking for.

Graphite carbon-relay not working

I have two graphite setup and I am trying to relay the traffic between the two, but somehow the carbon-relay is not working.
My cache runs on 2003/2004 and relay on 2013/2014
Following are the configurations done :
#carbon file
[cache:b]
LINE_RECEIVER_PORT = 2003
PICKLE_RECEIVER_PORT = 2004
CACHE_QUERY_PORT = 7012
[relay]
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2013
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2014
RELAY_METHOD = rules
REPLICATION_FACTOR = 1
DESTINATIONS = 127.0.0.1:2003:a, aa.bb.cc.dd:2003:b
#relay-rules file
[default]
default = true
destinations = 127.0.0.1:2003:a, aa.bb.cc.dd:2003:b
Any pointers will be helpful
As part of the recent project at work, I've figured out that carbon demons uses PICKLE protocol when sending data to the destinations.
So the destination of carbon-relay should be carbon-cache's pickle receiver port instead.
#carbon.conf
....
[relay]
LINE_RECEIVER_INTERFACE = 0.0.0.0
LINE_RECEIVER_PORT = 2013
PICKLE_RECEIVER_INTERFACE = 0.0.0.0
PICKLE_RECEIVER_PORT = 2014
RELAY_METHOD = rules
REPLICATION_FACTOR = 1
DESTINATIONS = 127.0.0.1:2004:a, aa.bb.cc.dd:2004:b
Also modify the relay-rules.conf with the same destinations specified in carbon.conf
relay-rules.conf
.....
[default]
default = true
destinations = 127.0.0.1:2004:a, aa.bb.cc.dd:2004:b

Creating JIRA issues with Jira4R

I'm trying to write a small Rails app that will interface with Jira using the Jira4R gem. However, whilst I'm having no problem creating an issue, I'm having real trouble attaching a custom field to an issue.
Any ideas on how I would do this?
At the moment I'm creating the issue like:
issue = Jira4R::V2::RemoteIssue.new
issue.project = "TEST"
issue.summary = params[:issue][:summary]
issue.description = params[:issue][:description]
issue.type = 6
issue = #jira.createIssue(issue)
issue = Jira4R::V2::RemoteIssue.new
issue.project = "TEST"
issue.summary = params[:issue][:summary]
issue.description = params[:issue][:description]
issue.type = 6
c = Jira4R::V2::RemoteCustomFieldValue.new
c.customfieldId = "customfield_10000"
c.values = current_user.full_name
issue.customFieldValues = [c]
issue = #jira.createIssue(issue)

Resources