如何使用 pushwoosh android 本机 SDK 获取 regID
how to get regID using pushwoosh android native SDK
我正在使用 PushWoosh android 本机 SDK 进行推送通知。我想在成功注册时重用 GCM 提供的 regId。如何使用 android 本机 SDK 获取此 regID?
当您从 GCM 注册中获取 regID 时,将其存储在 SharedPreferences
中以便稍后访问。
存储它
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(getApplicationContext());
String regId = gcm.register(ID);
SharedPreferences shp = getApplicationContext().getSharedPreferences("PrefKey",
getApplicationContext().MODE_PRIVATE);
shp.edit().putString("RegId",regId).commit();
得到它
SharedPreferences shp = getApplicationContext().getSharedPreferences("PrefKey",
getApplicationContext().MODE_PRIVATE);
if (shp != null && shp.contains("RegId"))
regId = shp.getString("RegId", null);
我正在使用 PushWoosh android 本机 SDK 进行推送通知。我想在成功注册时重用 GCM 提供的 regId。如何使用 android 本机 SDK 获取此 regID?
当您从 GCM 注册中获取 regID 时,将其存储在 SharedPreferences
中以便稍后访问。
存储它
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(getApplicationContext());
String regId = gcm.register(ID);
SharedPreferences shp = getApplicationContext().getSharedPreferences("PrefKey",
getApplicationContext().MODE_PRIVATE);
shp.edit().putString("RegId",regId).commit();
得到它
SharedPreferences shp = getApplicationContext().getSharedPreferences("PrefKey",
getApplicationContext().MODE_PRIVATE);
if (shp != null && shp.contains("RegId"))
regId = shp.getString("RegId", null);