• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

ANEにairのactive,diactiveイベントを通知したい

New Here ,
Jul 15, 2013 Jul 15, 2013

Copy link to clipboard

Copied

I have been working to create ANE looks like ad-mob. Java's WebView displays on air-android-environment for showing and rotating Advertising.

I succeeded to draw Java's WebView on air. What I really need to do is when activity goes behind, I need to notify deactive-event to ANEAdjarExtensionsContext, when activity goes in front I need to notify active-event. Otherwise "ANEAdjar_Adjarsdk" keep working if it is behind. If somebody know how to do please teach me.

admobのようなwebviewを使った広告表示をANEを使って行っています。

ANEにair上のactive,diactiveを通知したいです。

もしくは、java側でactivityのonPauseとかonResumeを取れれば問題ないのですが・・・。

画面が後ろに隠れた時、また前に戻って来たときの動作を指定したいです。

public class ANEAdjarExtensionsContext extends FREContext{

private ANEAdjar_Adjarsdk adsdk;

@Override
public void dispose()
{
   
Log.v("OREDOKO","dispose called");

   
try{

        adsdk
.onDestroy();
       
this.dispatchStatusEventAsync("onDestroy called", "fromNative");

   
}catch(Error e){
       
Log.v("OREDOKO",e.getMessage());

   
}
}

public Map<String, FREFunction> getFunctions()
{
   
try{
       
if(adsdk.equals(null)){
           
Log.v("OREDOKO","make instance ANEAdjar_Adjarsdk");
            adsdk
= new ANEAdjar_Adjarsdk();
       
}
   
}catch(Exception e){
       
Log.v("OREDOKO",e.getMessage());
   
}
   
Log.v("OREDOKO","instance of adsdk" + adsdk.toString());
   
//http://cda244.com/2011/12/22-174/

   
//adsdk = new ANEAdjar_Adjarsdk();
   
HashMap<String, FREFunction> func = new HashMap<String, FREFunction>();
    func
.put("vibrate", new ANEAdjar_vibrate() );               // vibrate
    func
.put("isSupported", new ANEAdjar_isSupported());
    func
.put("helloWorld", new ANEAdjar_helloWorld());
    func
.put("AdjarSDK", adsdk);
    func
.put("AdjarSDK_resume", new ANEAdjarExtensionsContext.onResume());
    func
.put("AdjarSDK_pause", new ANEAdjarExtensionsContext.onPause());

   
return func;
}

/**
* resume
* */

public class onResume implements FREFunction{
   
public FREObject call(FREContext arg0, FREObject[] arg1) {
   
Log.v("OREDOKO","FREObject onResume CALLED");

   
try{
       
ANEAdjarExtensionsContext.this.adsdk.onResume();
       
//adsdk.onResume();

       
return null;
   
}catch(Exception e){
       
Log.v("OREDOKO",e.getMessage());
   
}
   
return null;
   
}
}

/**
* pause
* */

public class onPause implements FREFunction{
   
public FREObject call(FREContext arg0, FREObject[] arg1) {
   
Log.v("OREDOKO","FREObject onPause CALLED");
   
try{
       
Log.v("OREDOKO","ONPAUSE");
       
ANEAdjarExtensionsContext.this.adsdk.onResume();
       
//adsdk.onPause();

       
return FREObject.newObject("FRE OBJECT CALL");
   
}catch(Exception e){
       
Log.v("OREDOKO",e.getMessage());
   
}
   
return null;
   
}
}    

Views

682

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines