本文将介绍ios–使用Apple推送通知(APN)进行Passbook时出现无效令牌的详细情况,。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于android
本文将介绍ios – 使用Apple推送通知(APN)进行Passbook时出现无效令牌的详细情况,。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于android APN cmnet切换cmwap、android APN current= 1 的所有数据都获取不到、Android Studio 制作的 Flutter Project 可以在 iOs 上实现 在你的 iOS 设备上测试你的 Flutter iOS 应用、android 网络判断工具类(APN+WIFI)的知识。
本文目录一览:- ios – 使用Apple推送通知(APN)进行Passbook时出现无效令牌
- android APN cmnet切换cmwap
- android APN current= 1 的所有数据都获取不到
- Android Studio 制作的 Flutter Project 可以在 iOs 上实现 在你的 iOS 设备上测试你的 Flutter iOS 应用
- android 网络判断工具类(APN+WIFI)
ios – 使用Apple推送通知(APN)进行Passbook时出现无效令牌
我的iPhone 4s已启用开发.为开发和生产启用了APP ID,并在配置文件中启用了设备.我已经验证了32字节二进制令牌数据相对于从设备发送的字符串令牌是正确的.
我的一个问题是,设备中的存折如何确定使用哪个令牌(开发与生产)?我现在更喜欢使用沙盒环境,但我不确定如何“选择”它.
我已经看到类似的主题,但似乎没有人能解决这个问题.这真是令人沮丧,因为我觉得我非常接近于完成这项工作!提前感谢您的任何建议!
解决方法
将通知发送到沙盒服务器时,您获得“无效令牌”这一事实意味着您正在使用生产令牌,该令牌仅适用于生产服务器.
将令牌发送到生产服务器返回反馈服务中的令牌这一事实意味着与证书匹配的应用程序(您的服务器用于发送通知)将从设备中卸载或禁用推送通知.也许您使用的是错误的证书(可能是属于从设备上卸载的其他应用程序的证书).
android APN cmnet切换cmwap
测试的时候,发现socket一直断,但是我用的是2G卡的,到底是什么原因引起的呢?经过切换APN,发现竟然可以了,移动的太TMD坑爹了
以下是从其他地方搬来的,调用接口
getCurrentApn() ;就OK
public static final Uri APN_TABLE_URI = Uri
.parse("content://telephony/carriers");// 所有的APN配配置信息位置
public static final Uri PREFERRED_APN_URI = Uri
.parse("content://telephony/carriers/preferapn");// 当前的APN
Cursor cursor_current;
Cursor cursor_need;
int newCreateAPNSet_Id;
private ArrayList<HashMap<String, String>> cmwapArrayList = new ArrayList<HashMap<String, String>>();
//获取当前的APN类型
private void getCurrentApn() {
if (!checkWapAPN()) {// 检查当前所有接入点中是否存在cmwap接入点,如果不存在任何cmwap接入点,则创建一个新的
// 创建一个新的cmwap接入点并返回该新创建的接入点的id值
Log.w("Log", "创建新的APN-------------------");
newCreateAPNSet_Id = addCmwapAPN();
Log.d("chenjianli", "info: newCreateAPNSet_Id is "
+ newCreateAPNSet_Id);
boolean fResult = SetDefaultAPN(newCreateAPNSet_Id);// 设置该新创建的接入点为当前接入点
Log.d("chenjianli", "info: fResult = " + fResult);// 立刻查询fResult的值为false还是true来判断当前接入点是否改变是没有意义的,因为手机改变当前接入点需要一段时间
Log
.d(
"chenjianli",
"info: current apn set is cmnet,and not have cmwap APN,we create new cmwap APN and then set it to mobile.");
} else {
Log.w("Log", "选择现存的APN=-----------------");
// 从所有满足条件的接入点中选择合适的接入点并设置
for (int i = 0; i != cmwapArrayList.size(); i++) {
String type = cmwapArrayList.get(i).get("type");
String proxy = cmwapArrayList.get(i).get("proxy");
String port = cmwapArrayList.get(i).get("port");
if (!type.equals("mms")
&& (proxy.equals("10.0.0.172") || proxy
.equals("010.000.000.172"))
&& port.equals("80")) {
String id = cmwapArrayList.get(i).get("_id");
SetDefaultAPN(Integer.parseInt(id));
Log
.d(
"chenjianli",
"info: current apn set is cmwap,and have cmwap set that we need,do not need to create new cmwap APN,just changed .");
return;
}
}
}
}
public boolean SetDefaultAPN(int id) {
boolean res = false;
ContentResolver resolver = client.getService().getContentResolver();
ContentValues values = new ContentValues();
values.put("apn_id", id);
try {
resolver.update(PREFERRED_APN_URI, values, null, null);
Cursor c = resolver.query(PREFERRED_APN_URI, new String[] { "name",
"apn" }, "_id=" + id, null, null);
if (c != null) {
res = true;
c.close();
}
} catch (SQLException e) {
// Log.d(TAG, "-----" + e.getMessage());
}
return res;
}
// 设置为cmwap网络
public boolean setAPN(int id) {
// 如果wifi是打开的,则关闭
boolean res = false;
ContentResolver resolver = client.getService().getContentResolver();
ContentValues values = new ContentValues();
values.put("apn_id", id);
try {
resolver.update(PREFERRED_APN_URI, values, null, null);
Cursor c = resolver.query(PREFERRED_APN_URI, new String[] { "name",
"apn" }, "_id=" + id, null, null);
if (c != null) {
res = true;
c.close();
}
} catch (SQLException e) {
Log.e("lhl", e.getMessage());
}
return res;
}
// 添加cmwap网络
TelephonyManager tm;
private int addCmwapAPN() {
ContentResolver cr = client.getService().getContentResolver();
ContentValues cv = new ContentValues();
cv.put("name", "cmwap");
cv.put("apn", "cmwap");
cv.put("proxy", "010.000.000.172");
cv.put("port", "80");
cv.put("current", 1);
tm = (TelephonyManager) client.getService().getSystemService(
Context.TELEPHONY_SERVICE);
String imsi = tm.getSubscriberId();
if (imsi != null) {
if (imsi.startsWith("46000")) {
cv.put("numeric", "46000");
cv.put("mcc", "460");
cv.put("mnc", "00");
} else if (imsi.startsWith("46002")) {
cv.put("numeric", "46002");
cv.put("mcc", "460");
cv.put("mnc", "02");
}
}
Cursor c = null;
try {
Uri newRow = cr.insert(APN_TABLE_URI, cv);
if (newRow != null) {
c = cr.query(newRow, null, null, null, null);
c.moveToFirst();
String id = c.getString(c.getColumnIndex("_id"));
setAPN(Integer.parseInt(id));
return Integer.parseInt(id);
}
} catch (SQLException e) {
Log.e("lhl", e.getMessage());
} finally {
if (c != null) {
c.close();
}
}
return 0;
}
private boolean checkWapAPN() {
Cursor cursor_need = client.getService().getContentResolver().query(
APN_TABLE_URI, null, "apn = \''cmwap\'' and current = 1", null,
null);
if (cursor_need != null) {
while (cursor_need.moveToNext()) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("type", cursor_need.getString(cursor_need
.getColumnIndex("type")));
map.put("_id", cursor_need.getString(cursor_need
.getColumnIndex("_id")));
map.put("proxy", cursor_need.getString(cursor_need
.getColumnIndex("proxy")));
map.put("port", cursor_need.getString(cursor_need
.getColumnIndex("port")));
cmwapArrayList.add(map);
}
return true;// 表示存在cmwap接入点
} else {
return false;// 表示不存在cmwap接入点
}
}
android APN current= 1 的所有数据都获取不到
老师好,我是做android开发的一实习生。
领导布置的任务下午快完成了,自己身边的几个android手机测试正常。但是拿起同学HTC,MIUI系统的手机,出错了。
输出当前正在使用的apn,没有数据输出。
在其他品牌的手机上测试都可以,但是HTC 手机MIUI系统上就不行,
public Uri preferapnUri = Uri
.parse("content://telephony/carriers/preferapn");
Android Studio 制作的 Flutter Project 可以在 iOs 上实现 在你的 iOS 设备上测试你的 Flutter iOS 应用
如何解决Android Studio 制作的 Flutter Project 可以在 iOs 上实现 在你的 iOS 设备上测试你的 Flutter iOS 应用
我对我的项目有疑问我终于从我在 Android Studio 上的 Flutter 项目中完成了,并在许多 android 设备上测试了它,现在我需要打开同一个项目并在 iOs 上测试它,我的问题是:-
- 我是否应该更改代码或文件中的某些内容以在 Xcode 上打开它?
- 我可以发布到 ipa 吗?
解决方法
在你的 iOS 设备上测试你的 Flutter iOS 应用
您只需按照以下步骤操作:
- 将
Runner.xcworkspace
文件放在项目文件夹的ios
文件夹中 - 双击打开该项目,它将在 Xcode 中启动(如果您安装了 Xcode)
- 然后使用 USB 数据线将您的 iOS 设备(实际手机)连接到 Xcode/MacBook
- 另外,不要忘记分别配置
Team
和Bundle Identifier
(如果您对Bundle Identifier
有任何问题):
在Signing & Capabilities
中,将Team
更改为Personal
(例如);
在 General
中,将 Bundle Identifier
编辑为独特的。
最后,您可以运行该应用了!
,对于 iOS,这有点复杂,因为您需要 Apple ID 或注册“开发者帐户”:
打开 XCode,然后打开“Preferences>Accounts”。使用您的 ID 登录。 “管理证书”> 单击“+”号并选择“iOS 开发”。 将您的设备插入您的机器。在下拉菜单中找到您的设备(窗口 > 管理器)。 在团队弹出菜单下方,单击修复问题。 在 Xcode 中,单击运行按钮。 (在后续运行中,您可以使用 Android Studio、VS Code 或任何其他选择的 IDE 部署到 iOS 设备,您只需要在第一次使用 Xcode 设置该证书。这是 Apple 的文档关于设置 Xcode 以运行物理设备。)
详情请点击链接How do I run/test my Flutter app on a real device?
android 网络判断工具类(APN+WIFI)
下面是小编 jb51.cc 通过网络收集整理的代码片段。
小编小编现在分享给大家,也给大家做个参考。
public class NetWorkHelper { private static String LOG_TAG = "NetWorkHelper"; public static Uri uri = Uri.parse("content://telephony/carriers"); /** * 判断是否有网络连接 */ public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity == null) { Log.w(LOG_TAG,"Couldn't get connectivity manager"); } else { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) { for (int i = 0; i < info.length; i++) { if (info[i].isAvailable()) { Log.d(LOG_TAG,"network is available"); return true; } } } } Log.d(LOG_TAG,"network is not available"); return false; } public static boolean checkNetState(Context context){ boolean netstate = false; ConnectivityManager connectivity = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); if(connectivity != null) { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) { for (int i = 0; i < info.length; i++) { if (info[i].getState() == NetworkInfo.State.CONNECTED) { netstate = true; break; } } } } return netstate; } /** * 判断网络是否为漫游 */ public static boolean isNetworkRoaming(Context context) { ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity == null) { Log.w(LOG_TAG,"Couldn't get connectivity manager"); } else { NetworkInfo info = connectivity.getActiveNetworkInfo(); if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE) { TelephonyManager tm = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); if (tm != null && tm.isNetworkRoaming()) { Log.d(LOG_TAG,"network is roaming"); return true; } else { Log.d(LOG_TAG,"network is not roaming"); } } else { Log.d(LOG_TAG,"not using mobile network"); } } return false; } /** * 判断MOBILE网络是否可用 * * @param context * @return * @throws Exception */ public static boolean isMobileDataEnable(Context context) throws Exception { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); boolean isMobileDataEnable = false; isMobileDataEnable = connectivityManager.getNetworkInfo( ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting(); return isMobileDataEnable; } /** * 判断wifi 是否可用 * @param context * @return * @throws Exception */ public static boolean isWifiDataEnable(Context context) throws Exception { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); boolean isWifiDataEnable = false; isWifiDataEnable = connectivityManager.getNetworkInfo( ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting(); return isWifiDataEnable; } /** * 设置Mobile网络开关 * * @param context * @param enabled * @throws Exception */ public static void setMobileDataEnabled(Context context,boolean enabled) throws Exception { APNManager apnManager=APNManager.getInstance(context); List<APN> list = apnManager.getAPNList(); if (enabled) { for (APN apn : list) { ContentValues cv = new ContentValues(); cv.put("apn",apnManager.matchAPN(apn.apn)); cv.put("type",apnManager.matchAPN(apn.type)); context.getContentResolver().update(uri,cv,"_id=?",new String[] { apn.apnId }); } } else { for (APN apn : list) { ContentValues cv = new ContentValues(); cv.put("apn",apnManager.matchAPN(apn.apn) + "mdev"); cv.put("type",apnManager.matchAPN(apn.type) + "mdev"); context.getContentResolver().update(uri,new String[] { apn.apnId }); } } } }
以上是小编(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给程序员好友。
关于ios – 使用Apple推送通知(APN)进行Passbook时出现无效令牌的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于android APN cmnet切换cmwap、android APN current= 1 的所有数据都获取不到、Android Studio 制作的 Flutter Project 可以在 iOs 上实现 在你的 iOS 设备上测试你的 Flutter iOS 应用、android 网络判断工具类(APN+WIFI)等相关内容,可以在本站寻找。
本文标签: