本文整理汇总了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();
}