當前位置: 首頁>>代碼示例>>Java>>正文


Java JPushInterface.getRegistrationID方法代碼示例

本文整理匯總了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;
	}
}
 
開發者ID:LuoLuo0101,項目名稱:JPush,代碼行數:27,代碼來源:MainActivity.java

示例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());
        }

    }
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:25,代碼來源:ActivityPresenter.java

示例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

    }
 
開發者ID:yuchenfw,項目名稱:QuickNews,代碼行數:27,代碼來源:MainActivity.java

示例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();
		}

	}
}
 
開發者ID:xujiaji,項目名稱:HaiNaBaiChuan,代碼行數:27,代碼來源:MainActivity.java

示例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);
	}
 
開發者ID:gizwits,項目名稱:GOpenSource_AppKit_Android_AS,代碼行數:20,代碼來源:GosPushManager.java

示例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.
		}
 
開發者ID:iYUYUE,項目名稱:Ushare,代碼行數:22,代碼來源:LoginActivity.java

示例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);
}
 
開發者ID:gizwits,項目名稱:GOpenSource_AppKit_Android_AS,代碼行數:37,代碼來源:GosPushManager.java

示例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);
}
 
開發者ID:pengkobe,項目名稱:nxtpush-cordova-plugin,代碼行數:9,代碼來源:JPushUtil.java


注:本文中的cn.jpush.android.api.JPushInterface.getRegistrationID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。