com.adobe.fre.FREObject Java Examples
The following examples show how to use
com.adobe.fre.FREObject.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShowFunction.java From ANEAdMob with Apache License 2.0 | 6 votes |
public FREObject call(FREContext frectx, FREObject[] args) { ExtensionContext ctx = (ExtensionContext)frectx; try { FREObject adID = args[0]; FREObject size = args[1]; FREObject halign = args[2]; FREObject valign = args[3]; FREObject testDevice = args[4]; ctx._adMobMan.show(adID.getAsString(), size.getAsInt(), halign.getAsInt(), valign.getAsInt(), (testDevice != null ? testDevice.getAsString() : null)); } catch(Exception e) { e.printStackTrace(); ctx.dispatchStatusEventAsync("BANNER_SHOW_FAIL", e.getMessage()); } return null; }
Example #2
Source File: AirGooglePlayGamesReportScoreFunction.java From ANE-Google-Play-Game-Services with Apache License 2.0 | 6 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { // TODO Auto-generated method stub // Retrieve alert parameters String leaderboardId = null; int newScore = 0; try { leaderboardId = arg1[0].getAsString(); newScore = arg1[1].getAsInt(); } catch (Exception e) { e.printStackTrace(); return null; } Extension.context.createHelperIfNeeded(arg0.getActivity()); Extension.context.reportScore(leaderboardId, newScore); return null; }
Example #3
Source File: SetSystemUiVisibilityFunction.java From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public FREObject call(FREContext context, FREObject[] args) { try { final FullScreenContext fsc = (FullScreenContext) context; int uiOptions = args[0].getAsInt(); fsc.resetUi(); fsc.setSystemUiVisibility(uiOptions); } catch (Exception e0) { try { return FREObject.newObject(false); } catch (Exception e1) { return null; } } try { return FREObject.newObject(true); } catch (Exception e2) {} return null; }
Example #4
Source File: SetVolumeFunction.java From ANEAdMob with Apache License 2.0 | 6 votes |
public FREObject call(FREContext frectx, FREObject[] args) { ExtensionContext ctx = (ExtensionContext)frectx; try { FREObject vol = args[0]; ctx._adMobMan.setVolume(vol.getAsDouble()); } catch(Exception e) { e.printStackTrace(); ctx.dispatchStatusEventAsync("INTERSTITIAL_CACHE_FAIL", e.getMessage()); } return null; }
Example #5
Source File: AirGooglePlayGamesReportAchievementFunction.java From ANE-Google-Play-Game-Services with Apache License 2.0 | 6 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { String achievementId = null; double percent = 0; try { achievementId = arg1[0].getAsString(); percent = arg1[1].getAsDouble(); } catch (Exception e) { e.printStackTrace(); return null; } Extension.context.createHelperIfNeeded(arg0.getActivity()); if (percent == 0) // it means we have unlocked it. { Extension.context.reportAchivements(achievementId); } else { Extension.context.reportAchivements(achievementId, percent); } return null; }
Example #6
Source File: InitFunction.java From ANEAdMob with Apache License 2.0 | 6 votes |
public FREObject call(FREContext frectx, FREObject[] args) { ExtensionContext ctx = (ExtensionContext)frectx; Activity act = ctx.getActivity(); try { ctx._adMobMan = new AdMobManager(act, ctx); ctx.dispatchStatusEventAsync("INIT_OK", ""); } catch(Exception e) { e.printStackTrace(); ctx.dispatchStatusEventAsync("INIT_FAIL", e.getMessage()); } return null; }
Example #7
Source File: AirGooglePlayGamesGetLeaderboardFunction.java From ANE-Google-Play-Game-Services with Apache License 2.0 | 6 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { Extension.context.createHelperIfNeeded(arg0.getActivity()); // Retrieve alert parameters String leaderboardId = null; try { leaderboardId = arg1[0].getAsString(); } catch (Exception e) { e.printStackTrace(); return null; } if( leaderboardId != null ) Extension.context.getLeaderboard( leaderboardId ); return null; }
Example #8
Source File: IsOperationalFunction.java From face-detection-ane with Apache License 2.0 | 6 votes |
@Override public FREObject call( FREContext context, FREObject[] args ) { super.call( context, args ); AIR.log( "FaceDetection::isOperational" ); Activity activity = AIR.getContext().getActivity(); FaceDetector.Builder fb = new FaceDetector.Builder( activity.getApplicationContext() ); final FaceDetector detector = fb.build(); try { return FREObject.newObject( detector.isOperational() ); } catch( FREWrongThreadException e ) { e.printStackTrace(); } return null; }
Example #9
Source File: CacheInterstitialFunction.java From ANEAdMob with Apache License 2.0 | 6 votes |
public FREObject call(FREContext frectx, FREObject[] args) { ExtensionContext ctx = (ExtensionContext)frectx; try { FREObject adID = args[0]; FREObject testDevice = args[1]; ctx._adMobMan.cacheInterstitial(adID.getAsString(), (testDevice != null ? testDevice.getAsString() : null)); } catch(Exception e) { e.printStackTrace(); ctx.dispatchStatusEventAsync("INTERSTITIAL_CACHE_FAIL", e.getMessage()); } return null; }
Example #10
Source File: InitFunction.java From AndroidInAppPurchase with Apache License 2.0 | 6 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { ExtensionContext ctx = (ExtensionContext)arg0; try { FREObject input = arg1[0]; String base64EncodedPublicKey = input.getAsString(); Billing billing = Billing.getInstance(); billing.init(arg0.getActivity(), ctx, base64EncodedPublicKey); } catch (Exception e) { e.printStackTrace(); } return null; }
Example #11
Source File: ImmersiveWidthFunction.java From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public FREObject call(FREContext context, FREObject[] args) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { try { View decorView = context.getActivity().getWindow().getDecorView(); Point outSize = new Point(); decorView.getDisplay().getRealSize(outSize); return FREObject.newObject(outSize.x); } catch (Exception e0) {} } try { return FREObject.newObject(0); } catch (Exception e1) { return null; } }
Example #12
Source File: ConsumeFunction.java From AndroidInAppPurchase with Apache License 2.0 | 6 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { try { FREObject sku = arg1[0]; Billing.getInstance().consume(sku.getAsString()); } catch (Exception e) { e.printStackTrace(); } return null; }
Example #13
Source File: TcpInit.java From vpn-over-dns with BSD 3-Clause "New" or "Revised" License | 6 votes |
public FREObject call(FREContext ctx, FREObject passedArgs[]) { this.ctx = ctx; try { FREObject port1_obj = passedArgs[0]; int port1 = port1_obj.getAsInt(); synchronized (listening_ports) { listening_ports.add(port1); } new Thread(this).start(); } catch (final Exception ex) { System.err.println(ex); ex.printStackTrace(); } return null; }
Example #14
Source File: SslGet.java From vpn-over-dns with BSD 3-Clause "New" or "Revised" License | 6 votes |
public FREObject call(FREContext ctx, FREObject passedArgs[]) { try { FREObject input1 = passedArgs[0]; url = input1.getAsString(); FREObject input2 = passedArgs[1]; query = input2.getAsString(); FREObject input3 = passedArgs[2]; timeout = input3.getAsInt(); new Thread(this).start(); } catch (final Exception ex) { ex.printStackTrace(); } return null; }
Example #15
Source File: ImmersiveHeightFunction.java From air-ane-fullscreen with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public FREObject call(FREContext context, FREObject[] args) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { try { View decorView = context.getActivity().getWindow().getDecorView(); Point outSize = new Point(); decorView.getDisplay().getRealSize(outSize); return FREObject.newObject(outSize.y); } catch (Exception e0) {} } try { return FREObject.newObject(0); } catch (Exception e1) { return null; } }
Example #16
Source File: AirGooglePlayGamesGetActivePlayerName.java From ANE-Google-Play-Game-Services with Apache License 2.0 | 6 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { Extension.context.createHelperIfNeeded(arg0.getActivity()); Player player = Games.Players.getCurrentPlayer(Extension.context.getApiClient()); FREObject playerName = null; if (player != null) { try { playerName = FREObject.newObject(player.getDisplayName()); } catch (FREWrongThreadException e) { e.printStackTrace(); } } return playerName; }
Example #17
Source File: GetApiKeyFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
public FREObject call(FREContext context, FREObject[] args) { super.call(context, args); try { Activity activity = context.getActivity(); ApplicationInfo ai = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), PackageManager.GET_META_DATA); String apiKey = ai.metaData.getString("io.fabric.ApiKey"); return FREObject.newObject(apiKey); } catch (Exception e) { e.printStackTrace(); return null; } }
Example #18
Source File: SetBoolFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
public FREObject call(FREContext context, FREObject[] args) { super.call(context, args); String key = getStringFromFREObject(args[0]); Boolean value = getBooleanFromFREObject(args[1]); Crashlytics.setBool(key, value); return null; }
Example #19
Source File: SetUserIdentifierFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
public FREObject call(FREContext context, FREObject[] args) { super.call(context, args); String userIdentifier = getStringFromFREObject(args[0]); Crashlytics.setUserIdentifier(userIdentifier); return null; }
Example #20
Source File: BaseFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
protected double getDoubleFromFREObject(FREObject object) { try { return object.getAsDouble(); } catch(Exception e) { e.printStackTrace(); return 0; } }
Example #21
Source File: SetStringFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
public FREObject call(FREContext context, FREObject[] args) { super.call(context, args); String key = getStringFromFREObject(args[0]); String value = getStringFromFREObject(args[1]); Crashlytics.setString(key, value); return null; }
Example #22
Source File: CrashFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
public FREObject call(FREContext context, FREObject[] args) { super.call(context, args); Intent intent = new Intent(context.getActivity().getApplicationContext(), CrashActivity.class); Boolean activityDeclared = (context.getActivity().getPackageManager().resolveActivity(intent, 0) != null); context.getActivity().startActivity(intent); try { return FREObject.newObject(activityDeclared); } catch (Exception e) { e.printStackTrace(); return null; } }
Example #23
Source File: BaseFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
protected String getStringFromFREObject(FREObject object) { try { return object.getAsString(); } catch (Exception e) { e.printStackTrace(); return null; } }
Example #24
Source File: SetIntFunction.java From ANE-Crashlytics with Apache License 2.0 | 5 votes |
public FREObject call(FREContext context, FREObject[] args) { super.call(context, args); String key = getStringFromFREObject(args[0]); int value = getIntFromFREObject(args[1]); Crashlytics.setInt(key, value); return null; }
Example #25
Source File: AirGooglePlayGamesShowAchievementsFunction.java From ANE-Google-Play-Game-Services with Apache License 2.0 | 5 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { Extension.context.createHelperIfNeeded(arg0.getActivity()); if (Extension.context.isSignedIn()) { arg0.getActivity().startActivityForResult(Games.Achievements.getAchievementsIntent(Extension.context.getApiClient()), RC_UNUSED); } return null; }
Example #26
Source File: AirGooglePlayStartAtLaunch.java From ANE-Google-Play-Game-Services with Apache License 2.0 | 5 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { Extension.context.logEvent("AirGooglePlayStartAtLaunch"); Intent intent = new Intent(arg0.getActivity().getApplicationContext(), SignInActivity.class); intent.putExtra("shouldStartSignInFlow", false); arg0.getActivity().startActivity(intent); return null; }
Example #27
Source File: DisposeFunction.java From ANEAdMob with Apache License 2.0 | 5 votes |
public FREObject call(FREContext frectx, FREObject[] args) { ExtensionContext ctx = (ExtensionContext)frectx; ctx._adMobMan.dispose(); ctx._adMobMan = null; return null; }
Example #28
Source File: HideFunction.java From ANEAdMob with Apache License 2.0 | 5 votes |
public FREObject call(FREContext frectx, FREObject[] args) { ExtensionContext ctx = (ExtensionContext)frectx; ctx._adMobMan.hide(); return null; }
Example #29
Source File: ShowInterstitialFunction.java From ANEAdMob with Apache License 2.0 | 5 votes |
public FREObject call(FREContext frectx, FREObject[] args) { ExtensionContext ctx = (ExtensionContext)frectx; ctx._adMobMan.showInterstitial(); return null; }
Example #30
Source File: PurchaseFunction.java From AndroidInAppPurchase with Apache License 2.0 | 5 votes |
@Override public FREObject call(FREContext arg0, FREObject[] arg1) { try { if(Billing.getInstance().activity() == null) //don't start another activity, if there is one already { FREObject sku = arg1[0]; FREObject type = arg1[1]; FREObject payload = arg1[2]; if(sku == null || sku.getAsString().length() == 0) Billing.getInstance()._ctx.dispatchStatusEventAsync("PURCHASE_ERROR", "Invalid product id."); else if(type == null || type.getAsString().length() == 0) Billing.getInstance()._ctx.dispatchStatusEventAsync("PURCHASE_ERROR", "Invalid purchase type."); else //everything's ok { Billing.getInstance().schedulePurchase(sku.getAsString(), type.getAsString(), (payload == null ? null : payload.getAsString())); Intent intent = new Intent(arg0.getActivity(), BillingActivity.class); arg0.getActivity().startActivity(intent); } } } catch (Exception e) { e.printStackTrace(); } return null; }