本文整理匯總了Java中com.facebook.react.bridge.ReactApplicationContext.getApplicationContext方法的典型用法代碼示例。如果您正苦於以下問題:Java ReactApplicationContext.getApplicationContext方法的具體用法?Java ReactApplicationContext.getApplicationContext怎麽用?Java ReactApplicationContext.getApplicationContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.react.bridge.ReactApplicationContext
的用法示例。
在下文中一共展示了ReactApplicationContext.getApplicationContext方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: RNPushNotificationModule
import com.facebook.react.bridge.ReactApplicationContext; //導入方法依賴的package包/類
RNPushNotificationModule(ReactApplicationContext reactContext) {
super(reactContext);
reactContext.addActivityEventListener(this);
Application applicationContext = (Application) reactContext.getApplicationContext();
// The @ReactNative methods use this
mRNPushNotificationHelper = new RNPushNotificationHelper(applicationContext);
// This is used to delivery callbacks to JS
mJsDelivery = new RNPushNotificationJsDelivery(reactContext);
registerNotificationsRegistration();
// //必須要設置默認的通知回調或者訂閱一個頻道,否則接收不到通知
// PushService.setDefaultPushCallback(reactContext.getApplicationContext(), mRNPushNotificationHelper.getMainActivityClass());
// //this.subscribeChannel("public");
}
示例2: BeaconsAndroidModule
import com.facebook.react.bridge.ReactApplicationContext; //導入方法依賴的package包/類
public BeaconsAndroidModule(ReactApplicationContext reactContext) {
super(reactContext);
Log.d(LOG_TAG, "BeaconsAndroidModule - started");
this.mReactContext = reactContext;
this.mApplicationContext = reactContext.getApplicationContext();
this.mBeaconManager = BeaconManager.getInstanceForApplication(mApplicationContext);
// Detect iBeacons ( http://stackoverflow.com/questions/25027983/is-this-the-correct-layout-to-detect-ibeacons-with-altbeacons-android-beacon-li )
addParser("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24");
mBeaconManager.bind(this);
}
示例3: handleRemotePushNotification
import com.facebook.react.bridge.ReactApplicationContext; //導入方法依賴的package包/類
private void handleRemotePushNotification(ReactApplicationContext context, Bundle bundle) {
// If notification ID is not provided by the user for push notification, generate one at random
if (bundle.getString("id") == null) {
Random randomNumberGenerator = new Random(System.currentTimeMillis());
bundle.putString("id", String.valueOf(randomNumberGenerator.nextInt()));
}
Boolean isForeground = isApplicationInForeground();
RNPushNotificationJsDelivery jsDelivery = new RNPushNotificationJsDelivery(context);
bundle.putBoolean("foreground", isForeground);
bundle.putBoolean("userInteraction", false);
jsDelivery.notifyNotification(bundle);
// If contentAvailable is set to true, then send out a remote fetch event
if (bundle.getString("contentAvailable", "false").equalsIgnoreCase("true")) {
jsDelivery.notifyRemoteFetch(bundle);
}
Log.v(LOG_TAG, "sendNotification: " + bundle);
if (!isForeground) {
Application applicationContext = (Application) context.getApplicationContext();
RNPushNotificationHelper pushNotificationHelper = new RNPushNotificationHelper(applicationContext);
pushNotificationHelper.sendToNotificationCentre(bundle);
}
}
示例4: ANModule
import com.facebook.react.bridge.ReactApplicationContext; //導入方法依賴的package包/類
public ANModule(ReactApplicationContext reactContext) {
super(reactContext);
anHelper = new ANHelper((Application) reactContext.getApplicationContext());
}
示例5: ImageCompressModule
import com.facebook.react.bridge.ReactApplicationContext; //導入方法依賴的package包/類
public ImageCompressModule(ReactApplicationContext reactContext) {
super(reactContext);
mContext = reactContext.getApplicationContext();
uriPath = new UriPath((Application) mContext);
}
示例6: SmsModule
import com.facebook.react.bridge.ReactApplicationContext; //導入方法依賴的package包/類
public SmsModule(ReactApplicationContext reactContext) {
super(reactContext);
mReactContext = reactContext;
smsList = new HashMap<Long, String>();
context = reactContext.getApplicationContext();
}
示例7: BaseModule
import com.facebook.react.bridge.ReactApplicationContext; //導入方法依賴的package包/類
public BaseModule(ReactApplicationContext reactContext) {
super(reactContext);
mReactContext = reactContext;
mContext = reactContext.getApplicationContext();
}