本文整理匯總了Java中cn.jpush.android.api.JPushInterface.getRegistrationID方法的典型用法代碼示例。如果您正苦於以下問題:Java JPushInterface.getRegistrationID方法的具體用法?Java JPushInterface.getRegistrationID怎麽用?Java JPushInterface.getRegistrationID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cn.jpush.android.api.JPushInterface
的用法示例。
在下文中一共展示了JPushInterface.getRegistrationID方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onClick
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.init:
init();
break;
case R.id.setting:
Intent intent = new Intent(MainActivity.this, PushSetActivity.class);
startActivity(intent);
break;
case R.id.stopPush:
JPushInterface.stopPush(getApplicationContext());
break;
case R.id.resumePush:
JPushInterface.resumePush(getApplicationContext());
break;
case R.id.getRegistrationId:
String rid = JPushInterface.getRegistrationID(getApplicationContext());
if (!rid.isEmpty()) {
mRegId.setText("RegId:" + rid);
} else {
Toast.makeText(this, "Get registration fail, JPush init failed!", Toast.LENGTH_SHORT).show();
}
break;
}
}
示例2: onCreate
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
mActivity = this;
activityManagerUtil = ActivityManagerUtil.getInstance();
activityManagerUtil.pushOneActivity(this);
registerMessageReceiver();
// RegisterReceive();
Jpinit();
rid = JPushInterface.getRegistrationID(getApplicationContext());
viewDelegate.create(getLayoutInflater(), null, savedInstanceState);
mvpPresenter = createPresenter();
setContentView(viewDelegate.getRootView());
initToolbar();
unbinder = ButterKnife.bind(this);
viewDelegate.initWidget();
mACache = ACache.get(this);
initData();
} catch (Exception e) {
F.e(e.toString());
}
}
示例3: onCreate
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fresco.initialize(this);
JPushInterface.init(this);
System.out.println("JPushInterface.getRegistrationID");
JPushInterface.init(getApplicationContext());
String rid = JPushInterface.getRegistrationID(getApplicationContext());
System.out.println("JPushInterface.getRegistrationID" + rid);
setContentView(R.layout.activity_main);
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
initView();
mNetReceiver = new NetWorkChangeReceiver();
IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(mNetReceiver, filter);
NetWorkState.mNetState = NetWorkState.isConn(MainActivity.this);
// registerMessageReceiver(); // used for receive msg
}
示例4: onClick
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.init) {
init();
} else if (i == R.id.setting) {
Intent intent = new Intent(MainActivity.this, PushSetActivity.class);
startActivity(intent);
} else if (i == R.id.stopPush) {
JPushInterface.stopPush(getApplicationContext());
} else if (i == R.id.resumePush) {
JPushInterface.resumePush(getApplicationContext());
} else if (i == R.id.getRegistrationId) {
String rid = JPushInterface.getRegistrationID(getApplicationContext());
if (!TextUtils.isEmpty(rid)) {
mRegId.setText("RegId:" + rid);
} else {
Toast.makeText(this, "Get registration fail, JPush init failed!", Toast.LENGTH_SHORT).show();
}
}
}
示例5: pushUnBindService
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
public static void pushUnBindService(String token) {
if (token.isEmpty()) {
return;
}
if (GizPushType.GizPushJiGuang == gizPushType) {
// 獲取JPush的RegistrationID,即Channel_ID
Channel_ID = JPushInterface.getRegistrationID(context);
} else if (GizPushType.GizPushBaiDu == gizPushType) {
// 獲取BDPush的Channel_ID
Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID;
} else {
return;
}
// TODO 綁定推送
Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token);
GizWifiSDK.sharedInstance().channelIDUnBind(token, Channel_ID);
}
示例6: doInBackground
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
@Override
protected Boolean doInBackground(Void... params) {
// TODO: attempt authentication against a network service.
// try {
// // Simulate network access.
// Thread.sleep(2000);
// } catch (InterruptedException e) {
// return false;
// }
String rid = JPushInterface.getRegistrationID(mContext);
return login(mEmail, mPassword, rid);
// SharedPreferences sharedPreferences = getSharedPreferences("Login", Context.MODE_MULTI_PROCESS);
// String result = sharedPreferences.getString("status", "");
////
// if(result.equals("success"))
// return true;
// TODO: register the new account here.
}
示例7: pushBindService
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 向雲端綁定推送
*
* @param Token
* @param Channel_ID
* @param gizPushType
*/
public static void pushBindService(String token) {
if (GizPushType.GizPushJiGuang == gizPushType) {
// 獲取JPush的RegistrationID,即Channel_ID
Channel_ID = JPushInterface.getRegistrationID(context);
// 設定JPush類型
JPushInterface.setAlias(context, Channel_ID, new TagAliasCallback() {
@Override
public void gotResult(int arg0, String arg1, Set<String> arg2) {
if (arg0 == 0) {
Log.i("Apptest", "Alias: " + arg1);
} else {
Log.e("Apptest", "Result: " + arg0);
}
}
});
} else if (GizPushType.GizPushBaiDu == gizPushType) {
// 獲取BDPush的Channel_ID
Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID;
} else {
return;
}
// TODO 綁定推送
Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token);
GizWifiSDK.sharedInstance().channelIDBind(token, Channel_ID, gizPushType);
}
示例8: getRegistrationID
import cn.jpush.android.api.JPushInterface; //導入方法依賴的package包/類
/**
* 獲取設備注冊 ID
*/
public static void getRegistrationID(JSONArray data, CallbackContext callbackContext) {
Context context = cordovaCxt;
String regID = JPushInterface.getRegistrationID(context);
callbackContext.success(regID);
}